by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"

Dependencies:   mbed

main.cpp

Committer:
robt
Date:
2013-06-16
Revision:
0:5775e366c477

File content as of revision 0:5775e366c477:

/* Program Example 12.2: Bluetooth serial sniffer program
                                                                */
#include "mbed.h"
Serial rn41(p9,p10);
BusOut led(LED4,LED3,LED2,LED1);

int main() {
  rn41.baud(115200);           // setup baud rate
  rn41.printf("Serial sniffer: outputs received data to LEDs\n\r");
  while (1) {
    if (rn41.readable()) {     // if data available
      char x=rn41.getc();      // get data
      led=x;                   // output LSByte to LEDs
    }
  }
}