![](/media/cache/group/218.jpg.50x50_q85.jpg)
via bluetooth uitlezen
Dependencies: mbed
main.cpp@0:1a51b2e26388, 2017-06-01 (annotated)
- Committer:
- joosthartkamp
- Date:
- Thu Jun 01 00:00:37 2017 +0000
- Revision:
- 0:1a51b2e26388
- Child:
- 1:351a8a56113a
via bluetooth uitlezen
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joosthartkamp | 0:1a51b2e26388 | 1 | #include "mbed.h" |
joosthartkamp | 0:1a51b2e26388 | 2 | |
joosthartkamp | 0:1a51b2e26388 | 3 | //------------------------------------ |
joosthartkamp | 0:1a51b2e26388 | 4 | // Hyperterminal configuration |
joosthartkamp | 0:1a51b2e26388 | 5 | // 9600 bauds, 8-bit data, no parity |
joosthartkamp | 0:1a51b2e26388 | 6 | //------------------------------------ |
joosthartkamp | 0:1a51b2e26388 | 7 | |
joosthartkamp | 0:1a51b2e26388 | 8 | Serial bt(D1, D0); |
joosthartkamp | 0:1a51b2e26388 | 9 | |
joosthartkamp | 0:1a51b2e26388 | 10 | |
joosthartkamp | 0:1a51b2e26388 | 11 | DigitalOut myled(LED1); |
joosthartkamp | 0:1a51b2e26388 | 12 | |
joosthartkamp | 0:1a51b2e26388 | 13 | |
joosthartkamp | 0:1a51b2e26388 | 14 | int main() |
joosthartkamp | 0:1a51b2e26388 | 15 | { |
joosthartkamp | 0:1a51b2e26388 | 16 | int i = 1; |
joosthartkamp | 0:1a51b2e26388 | 17 | bt.printf("lekker draadloos pik !\n"); |
joosthartkamp | 0:1a51b2e26388 | 18 | while(1) { |
joosthartkamp | 0:1a51b2e26388 | 19 | wait(1); |
joosthartkamp | 0:1a51b2e26388 | 20 | bt.printf("This program runs since %d seconds.\n", i++); |
joosthartkamp | 0:1a51b2e26388 | 21 | myled = !myled; |
joosthartkamp | 0:1a51b2e26388 | 22 | if (bt.readable() > 0) { |
joosthartkamp | 0:1a51b2e26388 | 23 | char c = bt.getc(); |
joosthartkamp | 0:1a51b2e26388 | 24 | bt.printf("stopped\n"); |
joosthartkamp | 0:1a51b2e26388 | 25 | |
joosthartkamp | 0:1a51b2e26388 | 26 | |
joosthartkamp | 0:1a51b2e26388 | 27 | } |
joosthartkamp | 0:1a51b2e26388 | 28 | } |
joosthartkamp | 0:1a51b2e26388 | 29 | |
joosthartkamp | 0:1a51b2e26388 | 30 | } |