Bluetooth device discovery example program.
Dependencies: F401RE-USBHost mbed-rtos mbed
main.cpp
- Committer:
- va009039
- Date:
- 2014-07-10
- Revision:
- 2:e8a25b254e33
- Parent:
- 0:c337e900ca01
File content as of revision 2:e8a25b254e33:
#include "USBHostRSSI.h" DigitalOut led1(LED1); void callback(inquiry_with_rssi_info* info) { static int n = 0; char buf[18]; info->bdaddr.str(buf, sizeof(buf)); printf("%d %s %d\n", n++, buf, info->rssi); led1 = !led1; } int main() { USBHostRSSI bt; if (!bt.connect()) { error("USB Bluetooth dongle not found.\n"); } bt.attachEvent(callback); while(1) { USBHost::poll(); } }