Musashi Aharon / Mbed 2 deprecated usb-serial

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #define LF      "\n"
00003 #define CRLF    "\r\n"
00004 #define NL      CRLF
00005 
00006 DigitalOut myled(LED_GREEN);
00007 Serial pc(USBTX, USBRX);
00008 
00009 
00010 int main()
00011 {
00012     int i = 0;
00013     pc.printf("Hello World!" NL);
00014 
00015     while (true) {
00016         wait(0.5f); // wait a small period of time
00017         pc.printf("%d" NL, i); // print the value of variable i
00018         i++; // increment the variable
00019         myled = !myled; // toggle a led
00020     }
00021 }