Modified hello world - usb debug message only

Dependencies:   mbed

Fork of mDot_helloworld by MultiTech

Committer:
mfiore
Date:
Wed Jun 10 16:56:38 2015 +0000
Revision:
0:fdc94d24e54a
Child:
1:34c1fcb8ea5a
first commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mfiore 0:fdc94d24e54a 1 /*************************************
mfiore 0:fdc94d24e54a 2 * This simple example program blinks
mfiore 0:fdc94d24e54a 3 * LED1 and prints a message out the
mfiore 0:fdc94d24e54a 4 * USB debug port.
mfiore 0:fdc94d24e54a 5 ************************************/
mfiore 0:fdc94d24e54a 6
mfiore 0:fdc94d24e54a 7 #include "mbed.h"
mfiore 0:fdc94d24e54a 8
mfiore 0:fdc94d24e54a 9 DigitalOut led(LED1);
mfiore 0:fdc94d24e54a 10 Ticker tick;
mfiore 0:fdc94d24e54a 11
mfiore 0:fdc94d24e54a 12 // callback function to change LED state
mfiore 0:fdc94d24e54a 13 void blink() {
mfiore 0:fdc94d24e54a 14 led = !led;
mfiore 0:fdc94d24e54a 15 }
mfiore 0:fdc94d24e54a 16
mfiore 0:fdc94d24e54a 17 int main() {
mfiore 0:fdc94d24e54a 18 // configure the Ticker to blink the LED on 500ms interval
mfiore 0:fdc94d24e54a 19 tick.attach(&blink, 0.5);
mfiore 0:fdc94d24e54a 20
mfiore 0:fdc94d24e54a 21 // print the message on 2s interval
mfiore 0:fdc94d24e54a 22 while (true) {
mfiore 0:fdc94d24e54a 23 printf("Hello world!\r\n");
mfiore 0:fdc94d24e54a 24 wait(2);
mfiore 0:fdc94d24e54a 25 }
mfiore 0:fdc94d24e54a 26 }