Werner Terreblanche
/
mBuino_low_power_led_flasher
mBuino low current/ deep sleep LED flasher to be used as key finder.
Revision 1:c0cfd1b0f4ef, committed 2014-09-17
- Comitter:
- wernert
- Date:
- Wed Sep 17 09:29:41 2014 +0000
- Parent:
- 0:346c8150ca74
- Commit message:
- Update to disable pull-up that were causing extra current to be drawn.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 346c8150ca74 -r c0cfd1b0f4ef main.cpp --- a/main.cpp Sat Sep 06 09:30:35 2014 +0000 +++ b/main.cpp Wed Sep 17 09:29:41 2014 +0000 @@ -1,5 +1,9 @@ #include "mbed.h" #include "WakeUp.h" +#include <stdlib.h> + + +DigitalIn progMode(P0_3); DigitalOut LED[] = {(P0_7), (P0_8), (P0_2), (P0_20), (P1_19), (P0_17), (P0_23)};// declare 7 LEDs @@ -10,21 +14,30 @@ __WFI(); } + int main() { int i = 0; + + + // Unconfigured GPIO pins default to having the internal pullups enabled. + // The board has a pull down on pin P0_3. This conflict was causing the extra power draw in sleep mode. + // Therefor we disable internal pull-ups to ensure low current mode + progMode.mode(PullNone); + + //The low-power oscillator can be quite inaccurate on some targets //this function calibrates it against the main clock WakeUp::calibrate(); while(1) { LED[i] = 1; // turn on - wait(.01); // delay + wait(.05); // delay LED[i] = 0; // turn off //Set wakeup time for second - WakeUp::set_ms(1000); + WakeUp::set_ms(5000); //Enter deepsleep, the program won't go beyond this point until it is woken up myDeepSleep(); i++;