Serial Communication
Dependencies: mbed
Fork of Nucleo_serial_menu by
Diff: main.cpp
- Revision:
- 4:fde2463b2846
- Parent:
- 3:8134f6d1ca47
- Child:
- 5:85178023086a
- Child:
- 9:6992eccf476e
--- a/main.cpp Wed Oct 12 07:32:52 2016 +0000 +++ b/main.cpp Tue Oct 18 08:26:25 2016 +0000 @@ -5,7 +5,7 @@ // 9600 bauds, 8-bit data, no parity //------------------------------------ -Serial pc(SERIAL_TX, SERIAL_RX); +Serial pc(D8, D2); DigitalOut myled(LED1); @@ -37,13 +37,14 @@ switch(data) { case '1': do { - if(state_menu == 0) { - pc.printf("LED Test\n"); - pc.printf("a.LED ON\n"); - pc.printf("s.LED OFF\n"); - pc.printf("x.Exit\n"); - state_menu = 1; - } + if(state_menu == 0) { + pc.printf("LED Test\n"); + pc.printf("a.LED ON\n"); + pc.printf("s.LED OFF\n"); + pc.printf("x.Exit\n"); + state_menu = 1; + } + if(pc.readable()) { data = pc.getc(); pc.printf("\n"); @@ -69,13 +70,10 @@ pc.printf("plz select a or s\n"); pc.printf("\n\n"); break; - } } - - - } while(state_exit ==0); + pc.printf("\n"); break; @@ -134,11 +132,5 @@ break; } } - - - - - - } }