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:
- yyue
- Date:
- 2016-10-13
- Revision:
- 0:3a4784da8745
File content as of revision 0:3a4784da8745:
#include "mbed.h"
#include "Led.h"
#include "Button.h"
Led myled(PD_15);
Led myled1(PD_12);
Led myled2(PD_13);
Led myled3(PD_14);
Button button(PA_0);
int main()
{
float delay = 0.01f;
while(1) {
while(button.isPressed()) {
myled.switchOff();
myled1.switchOff();
myled2.switchOff();
myled3.switchOff();
int led = rand() % 4;
if (led == 0) {
myled.flash(0.1);
} else if (led == 1) {
myled1.flash(0.1);
} else if (led==2) {
myled2.flash(0.1);
} else {
myled3.flash(0.1);
}
wait(delay);
}
}
}