Demo of serial stuff! Nice!

Dependencies:   MODSERIAL mbed

Dependents:   Minor_test_serial

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_GREEN);
00005 MODSERIAL pc(USBTX, USBRX);
00006 
00007 int main()
00008 {
00009     int i = 0;
00010     pc.baud(115200);
00011     pc.printf("Hello World!\r\n");
00012     
00013     while (true) {
00014         wait(0.5f); // wait a small period of time
00015         pc.printf("%d \r\n", i); // print the value of variable i
00016         i++; // increment the variable
00017         myled = !myled; // toggle a led
00018     }
00019 }