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:
- 0:3a4784da8745
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Oct 13 09:19:45 2016 +0000
@@ -0,0 +1,31 @@
+#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);
+ }
+ }
+}
\ No newline at end of file