A blinky variation for the mBuino with a bunch of different blink modes, deep-sleeping between iterations.
Dependencies: Crypto RNG mbed WakeUp
Fork of mBuinoBlinky by
mBuino blinky experiments.
main.cpp@0:aa0e1ad88af5, 2014-07-14 (annotated)
- Committer:
- Experiment626
- Date:
- Mon Jul 14 19:09:55 2014 +0000
- Revision:
- 0:aa0e1ad88af5
- Child:
- 1:47c61bf9c81e
mBuinoBlinky Published
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Experiment626 | 0:aa0e1ad88af5 | 1 | #include "mbed.h" |
Experiment626 | 0:aa0e1ad88af5 | 2 | |
Experiment626 | 0:aa0e1ad88af5 | 3 | DigitalOut LED[] = {(P0_7), (P0_8), (P0_2), (P0_20), (P1_19), (P0_17), (P0_23)};// declare 7 LEDs |
Experiment626 | 0:aa0e1ad88af5 | 4 | |
Experiment626 | 0:aa0e1ad88af5 | 5 | float delayTime = .05; |
Experiment626 | 0:aa0e1ad88af5 | 6 | |
Experiment626 | 0:aa0e1ad88af5 | 7 | int main() |
Experiment626 | 0:aa0e1ad88af5 | 8 | { |
Experiment626 | 0:aa0e1ad88af5 | 9 | while(1) |
Experiment626 | 0:aa0e1ad88af5 | 10 | { |
Experiment626 | 0:aa0e1ad88af5 | 11 | delayTime = 0.05; |
Experiment626 | 0:aa0e1ad88af5 | 12 | for(int x = 0; x < 7; x++) |
Experiment626 | 0:aa0e1ad88af5 | 13 | { |
Experiment626 | 0:aa0e1ad88af5 | 14 | LED[x] = 1; // turn on |
Experiment626 | 0:aa0e1ad88af5 | 15 | wait(.2); // delay |
Experiment626 | 0:aa0e1ad88af5 | 16 | |
Experiment626 | 0:aa0e1ad88af5 | 17 | LED[x] = 0; // turn off |
Experiment626 | 0:aa0e1ad88af5 | 18 | wait(delayTime); // delay |
Experiment626 | 0:aa0e1ad88af5 | 19 | } |
Experiment626 | 0:aa0e1ad88af5 | 20 | for(int x = 6; x >= 0; x--) |
Experiment626 | 0:aa0e1ad88af5 | 21 | { |
Experiment626 | 0:aa0e1ad88af5 | 22 | LED[x] = 1; // turn on |
Experiment626 | 0:aa0e1ad88af5 | 23 | wait(.2); // delay |
Experiment626 | 0:aa0e1ad88af5 | 24 | |
Experiment626 | 0:aa0e1ad88af5 | 25 | LED[x] = 0; // turn off |
Experiment626 | 0:aa0e1ad88af5 | 26 | wait(delayTime); // delay |
Experiment626 | 0:aa0e1ad88af5 | 27 | } |
Experiment626 | 0:aa0e1ad88af5 | 28 | |
Experiment626 | 0:aa0e1ad88af5 | 29 | for(int x = 0; x < 7; x++) |
Experiment626 | 0:aa0e1ad88af5 | 30 | { |
Experiment626 | 0:aa0e1ad88af5 | 31 | LED[x] = 1; // turn on |
Experiment626 | 0:aa0e1ad88af5 | 32 | wait(delayTime); // delay |
Experiment626 | 0:aa0e1ad88af5 | 33 | } |
Experiment626 | 0:aa0e1ad88af5 | 34 | for(int x = 6; x >= 0; x--) |
Experiment626 | 0:aa0e1ad88af5 | 35 | { |
Experiment626 | 0:aa0e1ad88af5 | 36 | LED[x] = 0; // turn off |
Experiment626 | 0:aa0e1ad88af5 | 37 | wait(delayTime); // delay |
Experiment626 | 0:aa0e1ad88af5 | 38 | } |
Experiment626 | 0:aa0e1ad88af5 | 39 | |
Experiment626 | 0:aa0e1ad88af5 | 40 | |
Experiment626 | 0:aa0e1ad88af5 | 41 | } |
Experiment626 | 0:aa0e1ad88af5 | 42 | } |