Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: F401RE-USBHost mbed-rtos mbed
main.cpp@2:e8a25b254e33, 2014-07-10 (annotated)
- Committer:
- va009039
- Date:
- Thu Jul 10 08:53:47 2014 +0000
- Revision:
- 2:e8a25b254e33
- Parent:
- 0:c337e900ca01
update mbed-rtos.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| va009039 | 0:c337e900ca01 | 1 | #include "USBHostRSSI.h" |
| va009039 | 0:c337e900ca01 | 2 | |
| va009039 | 0:c337e900ca01 | 3 | DigitalOut led1(LED1); |
| va009039 | 0:c337e900ca01 | 4 | |
| va009039 | 0:c337e900ca01 | 5 | void callback(inquiry_with_rssi_info* info) { |
| va009039 | 0:c337e900ca01 | 6 | static int n = 0; |
| va009039 | 0:c337e900ca01 | 7 | char buf[18]; |
| va009039 | 0:c337e900ca01 | 8 | info->bdaddr.str(buf, sizeof(buf)); |
| va009039 | 0:c337e900ca01 | 9 | printf("%d %s %d\n", n++, buf, info->rssi); |
| va009039 | 0:c337e900ca01 | 10 | led1 = !led1; |
| va009039 | 0:c337e900ca01 | 11 | } |
| va009039 | 0:c337e900ca01 | 12 | |
| va009039 | 0:c337e900ca01 | 13 | int main() { |
| va009039 | 0:c337e900ca01 | 14 | USBHostRSSI bt; |
| va009039 | 0:c337e900ca01 | 15 | if (!bt.connect()) { |
| va009039 | 0:c337e900ca01 | 16 | error("USB Bluetooth dongle not found.\n"); |
| va009039 | 0:c337e900ca01 | 17 | } |
| va009039 | 0:c337e900ca01 | 18 | bt.attachEvent(callback); |
| va009039 | 0:c337e900ca01 | 19 | while(1) { |
| va009039 | 0:c337e900ca01 | 20 | USBHost::poll(); |
| va009039 | 0:c337e900ca01 | 21 | } |
| va009039 | 0:c337e900ca01 | 22 | } |
| va009039 | 0:c337e900ca01 | 23 |