I'm using several of these: https://www.sparkfun.com/products/12580 to create a wireless sensor network. To discover the surrounding nodes I use an inquiry (shocker), and look for the name of the network (AQSN). However, it's about a 50-50 chance that it will not return the name of a node eg.
Inquiry, COD=0
Found 2
00066604B1D5,,1F00
442A60CD9281,Quan Wangâs Mac Pro,380104
Inquiry Done
Search Completed
Number of adjacent Nodes: 0
END
CMD
Inquiry, COD=0
Found 2
442A60CD9281,Quan Wangâs Mac Pro,380104
00066604B1D5,AQSN,1F00
Found neighbor: AQSN
Inquiry Done
Search Completed
Number of adjacent Nodes: 1
END
The code is rather lengthy... but here is the inquiry bit:
Void SearchForNodes()
{
Serial.println("searching for new neighbors");
bluetooth.print("$"); // Print three times individually
bluetooth.print("$");
bluetooth.print("$"); // Enter command mode
delay(100); // Short delay, wait for the Mate to send back CMD
bluetooth.println("I,12");
state = SearchingForNodes;
}
Does anyone have any suggestions on how to make this robust?