by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
main.cpp@0:49c6be914a81, 2013-06-16 (annotated)
- Committer:
- robt
- Date:
- Sun Jun 16 15:28:28 2013 +0000
- Revision:
- 0:49c6be914a81
by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
robt | 0:49c6be914a81 | 1 | /* Program Example 12.1: Bluetooth serial test data program |
robt | 0:49c6be914a81 | 2 | */ |
robt | 0:49c6be914a81 | 3 | #include "mbed.h" |
robt | 0:49c6be914a81 | 4 | Serial rn41(p9,p10); |
robt | 0:49c6be914a81 | 5 | BusOut led(LED4,LED3,LED2,LED1); |
robt | 0:49c6be914a81 | 6 | |
robt | 0:49c6be914a81 | 7 | int main() { |
robt | 0:49c6be914a81 | 8 | rn41.baud(115200); // set baud for RN41 |
robt | 0:49c6be914a81 | 9 | while (1) { |
robt | 0:49c6be914a81 | 10 | for (char x=0x30;x<=0x39;x++){ // ASCII numerical characters 0-9 |
robt | 0:49c6be914a81 | 11 | rn41.putc(x); // send test char data on serial |
robt | 0:49c6be914a81 | 12 | led = x & 0x0F; // set LEDs to count in binary |
robt | 0:49c6be914a81 | 13 | wait(0.5); |
robt | 0:49c6be914a81 | 14 | } |
robt | 0:49c6be914a81 | 15 | } |
robt | 0:49c6be914a81 | 16 | } |
robt | 0:49c6be914a81 | 17 |