Tatsuki Fukuda
/
SerialTest
Serial test program
Diff: main.cpp
- Revision:
- 0:b3252151233e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun May 11 09:02:57 2014 +0000 @@ -0,0 +1,19 @@ +#include "mbed.h" +Serial pc(USBTX, USBRX); // tx, rx +BusOut leds(LED1,LED2,LED3,LED4); + +void pc_rx () +{ + int buff=pc.getc(); + leds=buff; +} +int main() +{ + pc.baud(9600); + pc.printf("HelloWorld!"); + pc.attach(&pc_rx,Serial::RxIrq); + while(1) { + sleep(); + pc.printf("HelloWorld!"); + }; +} \ No newline at end of file