Rob Toulson / Mbed 2 deprecated PE_12-02_BluetoothSniffer

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /* Program Example 12.2: Bluetooth serial sniffer program
00002                                                                 */
00003 #include "mbed.h"
00004 Serial rn41(p9,p10);
00005 BusOut led(LED4,LED3,LED2,LED1);
00006 
00007 int main() {
00008   rn41.baud(115200);           // setup baud rate
00009   rn41.printf("Serial sniffer: outputs received data to LEDs\n\r");
00010   while (1) {
00011     if (rn41.readable()) {     // if data available
00012       char x=rn41.getc();      // get data
00013       led=x;                   // output LSByte to LEDs
00014     }
00015   }
00016 }
00017