Ticker blinking four leds
Dependencies: mbed
Revision 3:708851531127, committed 2022-09-30
- Comitter:
- mus3
- Date:
- Fri Sep 30 20:50:45 2022 +0000
- Parent:
- 2:8b678520a9fb
- Commit message:
- change it to 4 tickers
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Sep 30 20:46:33 2022 +0000
+++ b/main.cpp Fri Sep 30 20:50:45 2022 +0000
@@ -1,6 +1,9 @@
#include "mbed.h"
-Ticker flipper;
+Ticker flipper1;
+Ticker flipper2;
+Ticker flipper3;
+Ticker flipper4;
DigitalOut led1(LED1);
DigitalOut led2(LED2);
DigitalOut led3(LED3);
@@ -21,12 +24,12 @@
}
int main() {
- flipper.attach(&flip2, 2 ); // the address of the function to be attached (flip) and the interval (2 seconds)
- flipper.attach(&flip1, 1);
- flipper.attach(&flip3, 4);
- flipper.attach(&flip4, 8);
+ flipper2.attach(&flip2, 2 ); // the address of the function to be attached (flip) and the interval (2 seconds)
+ flipper1.attach(&flip1, 1);
+ flipper3.attach(&flip3, 4);
+ flipper4.attach(&flip4, 8);
// spin in a main loop. flipper will interrupt it to call flip
while(1) {
i++;
- }
+ }
}
\ No newline at end of file