This is single way communication with the PC
Dependencies: mbed
main.cpp
- Committer:
- RahulSitaram
- Date:
- 2016-12-04
- Revision:
- 0:5d7b0ed9dcc9
- Child:
- 1:dad12410fd2d
File content as of revision 0:5d7b0ed9dcc9:
#include "mbed.h" DigitalOut led1(LED1); DigitalOut led2(LED2); uint8_t data; Serial pc(USBTX, USBRX); void call() { // Note: you need to actually read from the serial to clear the RX interrupt data = pc.getc(); printf("%c\n", data); led2 = !led2; } int main() { pc.attach(&call); while (1) { led1 = !led1; wait(0.5); } }