![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
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@2:fd6008aa85cd, 2014-09-05 (annotated)
- Committer:
- mikewebkist
- Date:
- Fri Sep 05 01:34:02 2014 +0000
- Revision:
- 2:fd6008aa85cd
- Parent:
- 1:47c61bf9c81e
- Child:
- 3:f3e484ae4439
rainbow plus random
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Experiment626 | 0:aa0e1ad88af5 | 1 | #include "mbed.h" |
mikewebkist | 2:fd6008aa85cd | 2 | #include "RNG/Random.h" |
Experiment626 | 0:aa0e1ad88af5 | 3 | |
Experiment626 | 0:aa0e1ad88af5 | 4 | DigitalOut LED[] = {(P0_7), (P0_8), (P0_2), (P0_20), (P1_19), (P0_17), (P0_23)};// declare 7 LEDs |
Experiment626 | 0:aa0e1ad88af5 | 5 | |
Experiment626 | 0:aa0e1ad88af5 | 6 | float delayTime = .05; |
mikewebkist | 2:fd6008aa85cd | 7 | int rndLED = 0; |
mikewebkist | 2:fd6008aa85cd | 8 | Random RNG = Random(); |
Experiment626 | 0:aa0e1ad88af5 | 9 | |
Experiment626 | 0:aa0e1ad88af5 | 10 | int main() |
Experiment626 | 0:aa0e1ad88af5 | 11 | { |
Experiment626 | 0:aa0e1ad88af5 | 12 | while(1) |
Experiment626 | 0:aa0e1ad88af5 | 13 | { |
mikewebkist | 1:47c61bf9c81e | 14 | for(int x=0; x<7; x++) |
Experiment626 | 0:aa0e1ad88af5 | 15 | { |
mikewebkist | 1:47c61bf9c81e | 16 | LED[x] = 1; |
mikewebkist | 1:47c61bf9c81e | 17 | wait(delayTime); |
mikewebkist | 2:fd6008aa85cd | 18 | // LED[x] = 0; |
Experiment626 | 0:aa0e1ad88af5 | 19 | } |
mikewebkist | 2:fd6008aa85cd | 20 | |
mikewebkist | 2:fd6008aa85cd | 21 | for(int x=6; x>=0; x--) |
Experiment626 | 0:aa0e1ad88af5 | 22 | { |
mikewebkist | 2:fd6008aa85cd | 23 | LED[x] = 0; |
mikewebkist | 1:47c61bf9c81e | 24 | wait(delayTime); |
Experiment626 | 0:aa0e1ad88af5 | 25 | } |
Experiment626 | 0:aa0e1ad88af5 | 26 | |
mikewebkist | 2:fd6008aa85cd | 27 | for(int x=0; x<20; x++) { |
mikewebkist | 2:fd6008aa85cd | 28 | rndLED = (int) RNG.getByte() % 8; |
mikewebkist | 2:fd6008aa85cd | 29 | LED[rndLED]=1; |
mikewebkist | 2:fd6008aa85cd | 30 | wait(0.2); |
mikewebkist | 2:fd6008aa85cd | 31 | LED[rndLED]=0; |
mikewebkist | 2:fd6008aa85cd | 32 | } |
Experiment626 | 0:aa0e1ad88af5 | 33 | } |
Experiment626 | 0:aa0e1ad88af5 | 34 | } |