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.
Fork of frdm_echo by
main.cpp
- Committer:
- silverpanda
- Date:
- 2014-04-14
- Revision:
- 6:78a965b2d2df
- Parent:
- 5:03b7c237c4c4
- Child:
- 7:19da09fe546b
File content as of revision 6:78a965b2d2df:
// Print "Hello World" to the PC
#include "mbed.h"
#include "shell.h"
Ticker *scanTicker;
Shell *usbSerialShell;
bool scanUSBSerialRxFlag;
void setScanUSBSerialRxFlag()
{
scanUSBSerialRxFlag = true;
}
//-----------------------------------------------------------------------------
void initMain()
{
// increase the baud rate for the USB serial port
usbSerialShell = new Shell(115200);
// send greeting with first cursor
usbSerialShell->sendHelloWorld();
// start polling for characters
scanTicker = new Ticker();
scanTicker->attach(&setScanUSBSerialRxFlag, 0.01);
scanUSBSerialRxFlag = false;
}
//-----------------------------------------------------------------------------
int main() {
initMain();
while(true) {
// check the flag
if(scanUSBSerialRxFlag) {
usbSerialShell->scanUSBSerialRx();
scanUSBSerialRxFlag = false;
}
// give the main loop some time
wait(0.02);
}
}
//-----------------------------------------------------------------------------
