Bluetooth device discovery example program.
Dependencies: F401RE-USBHost mbed-rtos mbed
main.cpp
00001 #include "USBHostRSSI.h" 00002 00003 DigitalOut led1(LED1); 00004 00005 void callback(inquiry_with_rssi_info* info) { 00006 static int n = 0; 00007 char buf[18]; 00008 info->bdaddr.str(buf, sizeof(buf)); 00009 printf("%d %s %d\n", n++, buf, info->rssi); 00010 led1 = !led1; 00011 } 00012 00013 int main() { 00014 USBHostRSSI bt; 00015 if (!bt.connect()) { 00016 error("USB Bluetooth dongle not found.\n"); 00017 } 00018 bt.attachEvent(callback); 00019 while(1) { 00020 USBHost::poll(); 00021 } 00022 } 00023
Generated on Fri Jul 15 2022 10:21:22 by 1.7.2