![](/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.
Diff: main.cpp
- Revision:
- 12:c94348aca325
- Parent:
- 11:be76674d2dbd
- Child:
- 13:292326e5d3bb
--- a/main.cpp Mon Sep 08 16:09:31 2014 +0000 +++ b/main.cpp Tue Sep 09 12:21:48 2014 +0000 @@ -14,7 +14,7 @@ __WFI(); } -void sweep(float delayTime) +void sweepMode(float delayTime) { for(int x=0; x<7; x++) { @@ -130,12 +130,33 @@ } } +void bumpMode(float delayTime) { + for(int x=0; x<3; x++) { + LED[x]=1; + LED[6-x]=1; + wait(delayTime * 2); + LED[x]=0; + LED[6-x]=0; + } + LED[3]=1; + wait(delayTime * 2); + LED[3]=0; + for(int x=0; x<3; x++) { + LED[2-x]=1; + LED[4+x]=1; + wait(delayTime * 2); + LED[2-x]=0; + LED[4+x]=0; + } + wait(delayTime * 4); +} + int main() { while(1) { - sweep(0.05); - int x = (int) RNG.getByte() % 6; + bumpMode(0.05); + int x = (int) RNG.getByte() % 7; switch(x) { case 0: binaryMode(0.05); @@ -155,9 +176,12 @@ case 5: multiSweepMode(0.05); break; + case 6: + sweepMode(0.05); + break; } - sweep(0.05); - WakeUp::set_ms(30000); + bumpMode(0.05); + WakeUp::set(1); myDeepSleep(); } }