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

Dependencies:   mbed

Committer:
robt
Date:
Sun Jun 16 15:28:59 2013 +0000
Revision:
0:5775e366c477
by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"

Who changed what in which revision?

UserRevisionLine numberNew contents of line
robt 0:5775e366c477 1 /* Program Example 12.2: Bluetooth serial sniffer program
robt 0:5775e366c477 2 */
robt 0:5775e366c477 3 #include "mbed.h"
robt 0:5775e366c477 4 Serial rn41(p9,p10);
robt 0:5775e366c477 5 BusOut led(LED4,LED3,LED2,LED1);
robt 0:5775e366c477 6
robt 0:5775e366c477 7 int main() {
robt 0:5775e366c477 8 rn41.baud(115200); // setup baud rate
robt 0:5775e366c477 9 rn41.printf("Serial sniffer: outputs received data to LEDs\n\r");
robt 0:5775e366c477 10 while (1) {
robt 0:5775e366c477 11 if (rn41.readable()) { // if data available
robt 0:5775e366c477 12 char x=rn41.getc(); // get data
robt 0:5775e366c477 13 led=x; // output LSByte to LEDs
robt 0:5775e366c477 14 }
robt 0:5775e366c477 15 }
robt 0:5775e366c477 16 }
robt 0:5775e366c477 17