Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 3:7188bd978801
- Parent:
- 2:53d8e47c5171
- Child:
- 4:dfb672184380
--- a/main.cpp Sun Apr 13 20:49:35 2014 +0000 +++ b/main.cpp Mon Apr 14 00:33:00 2014 +0000 @@ -4,7 +4,7 @@ Serial usbSerial(USBTX, USBRX); Ticker messageTicker, scanTicker; -bool sendHelloWorldFlag, scanUSBSerialRxFlag; +bool scanUSBSerialRxFlag; void sendText(char *thisText) { @@ -14,14 +14,7 @@ void sendHelloWorld() { - sendText("Hello World\n"); - sendHelloWorldFlag = false; -} -//----------------------------------------------------------------------------- - -void setSendHelloWorldFlag() -{ - sendHelloWorldFlag = true; + sendText("** Hello World **\n\n> "); } //----------------------------------------------------------------------------- @@ -29,7 +22,7 @@ { if(usbSerial.readable()) { char character = usbSerial.getc(); - if((character == ';') || (character == 13)) usbSerial.printf("\n"); + if((character == ';') || (character == 13)) usbSerial.printf("\n> "); else usbSerial.printf("%c", character); } scanUSBSerialRxFlag = false; @@ -45,9 +38,7 @@ void initMain() { usbSerial.baud(115200); - // usbSerial.attach(&usbSerialIrq); - messageTicker.attach(&setSendHelloWorldFlag, 10.0); sendHelloWorld(); scanTicker.attach(&setScanUSBSerialRxFlag, 0.01); @@ -59,7 +50,6 @@ initMain(); while(true) { - if(sendHelloWorldFlag) sendHelloWorld(); if(scanUSBSerialRxFlag) scanUSBSerialRx(); wait(0.02); }