serial test

Dependencies:   mbed

Fork of Minor_test_serial by First Last

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 DigitalOut myled(LED_GREEN);
00004 Serial pc(USBTX, USBRX, "YOLO");
00005 
00006 int main()
00007 {
00008     pc.baud(115200);
00009     pc.printf("Hello World!\n");
00010     
00011     while (true) {
00012         char c = pc.getc();     //get a character from the computer keyboard
00013         pc.printf("%c\r\n",c);  //print the pressed character
00014         myled = !myled;         // toggle the green LED
00015     }
00016 }