Rohan Iyengar
/
MBED_SERIAL_TEST
Process Data from Serial port and give keyboard shortcut
Diff: main.cpp
- Revision:
- 0:7fe62cc94779
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Dec 12 10:47:50 2016 +0000 @@ -0,0 +1,26 @@ +#include "mbed.h" + +Serial pc(USBTX, USBRX); +DigitalOut myled(LED1); + +char buffer[20]; +char hi; +volatile char curr[20]; + +int main() { + myled = 1; + while(1) { + wait(.01); + if (pc.readable()) { + pc.scanf("%s", buffer); + //hi = (char) pc.getc(); + //curr = buffer; + pc.printf(buffer); + myled = 1; + } else { + //pc.printf(curr + "\n"); + myled = 0; + } + //pc.printf(curr); + } +}