Light is blue and toggles after pressing key.

Dependencies:   MODSERIAL 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 #include "MODSERIAL.h"
00003 
00004 DigitalOut myled(LED_BLUE);
00005 MODSERIAL pc(USBTX, USBRX);
00006 
00007 char c;
00008 
00009 int main()
00010 {
00011     int i = 0;
00012     pc.baud(115200);
00013     c = pc.getc();
00014     pc.printf("Pressed Key: %c\n",c);
00015     
00016     while (true) {
00017         wait(0.5f); // wait a small period of time
00018        // pc.printf("%d \r\n", i); // print the value of variable i
00019         i++; // increment the variable
00020         myled = !myled; // toggle a led
00021     }
00022 }