Code examples and extended information

In the Waspmote Development section you can find complete examples about using this module: http://www.libelium.com/development/waspmote/examples

Next lines show a complete example of use for scanning functions.

/*
 *  ------------------ [BT PRO_01] - Normal scan ------------------- 
 *
 *  Explanation: This example shows how to make a normal scan with 
 *  Bluetooth module Pro, printing number of discovered devices 
 *  and storing them into SD card. 
 *
 *  Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L.
 *  http://www.libelium.com
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 * 
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see .
 *
 *  Version:		1.1
 *  Design:			David Gascón
 *  Implementation:	Javier Siscart
 */

#include "WaspBT_Pro.h"

void setup()
{
  
  USB.println(F("BT_PRO_01 Example"));

  // Turn On Bluetooth module
  BT_Pro.ON(SOCKET1);

}

void loop()
{

  // 1. Normal scan
  USB.println("Scan 5s.");
  BT_Pro.scanNetwork(5,TX_POWER_6);
  USB.print("discovered devices=");
  USB.println(BT_Pro.numberOfDevices, DEC);

  // 2. Print data of last inquiry (only debug purposes)
  BT_Pro.printInquiry();

}

Last updated