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:
- 1:ae75c5bfd6c6
- Parent:
- 0:679afb0ef65b
diff -r 679afb0ef65b -r ae75c5bfd6c6 main.cpp
--- a/main.cpp Sun May 22 18:15:44 2022 +0000
+++ b/main.cpp Sun May 22 18:20:40 2022 +0000
@@ -1,12 +1,21 @@
#include "mbed.h"
-
-DigitalOut myled(LED1);
-
+InterruptIn button(p5);
+DigitalOut led(LED1);
+DigitalOut flash(LED2);
+void flip(){
+ led=1;
+ wait(0.2);
+ led=0;
+ wait(0.2);
+ }
+
int main() {
- while(1) {
- myled = 1;
- wait(0.2);
- myled = 0;
- wait(0.2);
- }
+ button.rise(&flip);
+ while(1) {
+ flash = 1;
+ wait(0.2);
+ led = 0;
+ wait(0.2);
+ }
}
+
\ No newline at end of file