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
Diff: main.cpp
- Revision:
- 13:019e24491f32
- Parent:
- 12:b846b64e3980
- Child:
- 14:73ef945b8def
--- a/main.cpp Thu Apr 17 15:38:08 2014 +0000 +++ b/main.cpp Fri Apr 18 21:33:57 2014 +0000 @@ -1,19 +1,35 @@ // Print "Hello World" to the PC +// push buttons: +// sw2 on PTC6 +// sw3 on PTA4 + #include "mbed.h" #include "shell.h" #include "LEDColors.h" +#include "PushButtons.h" Ticker *scanTicker; Shell *usbSerialShell; LEDColors *ledColors; +PushButtons *pushButtons; bool scanUSBSerialRxFlag; +void pushButtonPressed() +{ + if(pushButtons->getPressed(pb2)) ledColors->flash(lcBlue, 10); + if(pushButtons->getPressed(pb3)) ledColors->flash(lcGreen, 10); + if(pushButtons->getJustPressed(pb2)) usbSerialShell->reportPushButtonPress(pb2); + if(pushButtons->getJustPressed(pb3)) usbSerialShell->reportPushButtonPress(pb3); +} +//----------------------------------------------------------------------------- + void at10msTick() { scanUSBSerialRxFlag = true; ledColors->tick10ms(); + if(pushButtons->tick10ms()) pushButtonPressed(); } //----------------------------------------------------------------------------- @@ -31,6 +47,7 @@ scanUSBSerialRxFlag = false; ledColors = new LEDColors(); + pushButtons = new PushButtons(); } //-----------------------------------------------------------------------------