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.
Revision 11:be76674d2dbd, committed 2014-09-08
- Comitter:
- mikewebkist
- Date:
- Mon Sep 08 16:09:31 2014 +0000
- Parent:
- 10:8a901b6d8cfa
- Child:
- 12:c94348aca325
- Commit message:
- Instead of showing all modes, pick one randomly then sleep for 30secs.
Changed in this revision
WakeUp.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WakeUp.lib Mon Sep 08 16:09:31 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/Sissors/code/WakeUp/#b2a710aca356
--- a/main.cpp Mon Sep 08 01:20:52 2014 +0000 +++ b/main.cpp Mon Sep 08 16:09:31 2014 +0000 @@ -1,5 +1,6 @@ #include "mbed.h" #include "RNG/Random.h" +#include "WakeUp/WakeUp.h" DigitalOut LED[] = {(P0_7), (P0_8), (P0_2), (P0_20), (P1_19), (P0_17), (P0_23)};// declare 7 LEDs @@ -134,17 +135,29 @@ while(1) { sweep(0.05); - binaryMode(0.05); - sweep(0.05); - randomMode(0.05); - sweep(0.05); - grayMode(0.05); + int x = (int) RNG.getByte() % 6; + switch(x) { + case 0: + binaryMode(0.05); + break; + case 1: + randomMode(0.05); + break; + case 2: + grayMode(0.05); + break; + case 3: + bounceMode(0.05); + break; + case 4: + pileMode(0.05); + break; + case 5: + multiSweepMode(0.05); + break; + } sweep(0.05); - bounceMode(0.05); - sweep(0.05); - pileMode(0.05); - sweep(0.05); - multiSweepMode(0.05); + WakeUp::set_ms(30000); myDeepSleep(); } }