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.
main.cpp
- Committer:
- sewins
- Date:
- 2015-10-20
- Revision:
- 0:c8839987d3b9
File content as of revision 0:c8839987d3b9:
#include "mbed.h" #include "stdlib.h" #include "led.h" #include "button.h" Led redLed("red"); Led greenLed("green"); Led orangeLed("orange"); Led blueLed("blue"); Button button("user"); int main() { const float delay = 0.01f; while(1) { while (button.isPressed()) { redLed.Off(); greenLed.Off(); orangeLed.Off(); blueLed.Off(); } int led = rand() % 4; if(led == 0) { redLed.On(); } else if (led == 1) { greenLed.On(); } else if (led == 2) { orangeLed.On(); } else { blueLed.On(); } wait(delay); } }