sleep() program for mbed NXP LPC11U24 beta
main.cpp@1:61c2a1be2fac, 2011-10-21 (annotated)
- Committer:
- chris
- Date:
- Fri Oct 21 22:57:49 2011 +0000
- Revision:
- 1:61c2a1be2fac
- Parent:
- 0:7170e3ed7284
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chris | 0:7170e3ed7284 | 1 | #include "mbed.h" |
chris | 0:7170e3ed7284 | 2 | |
chris | 0:7170e3ed7284 | 3 | BusOut leds(LED1,LED2,LED3,LED4); |
chris | 0:7170e3ed7284 | 4 | |
chris | 0:7170e3ed7284 | 5 | Ticker wakeup; |
chris | 0:7170e3ed7284 | 6 | |
chris | 0:7170e3ed7284 | 7 | void dostuff() { |
chris | 0:7170e3ed7284 | 8 | for (int i=0; i<5; i++) { |
chris | 0:7170e3ed7284 | 9 | leds = 1 << i; |
chris | 0:7170e3ed7284 | 10 | wait(0.25); |
chris | 0:7170e3ed7284 | 11 | } |
chris | 0:7170e3ed7284 | 12 | } |
chris | 0:7170e3ed7284 | 13 | |
chris | 0:7170e3ed7284 | 14 | int main () { |
chris | 0:7170e3ed7284 | 15 | |
chris | 0:7170e3ed7284 | 16 | wakeup.attach(NULL, 3.0); |
chris | 0:7170e3ed7284 | 17 | |
chris | 0:7170e3ed7284 | 18 | while (1) { |
chris | 0:7170e3ed7284 | 19 | dostuff(); |
chris | 0:7170e3ed7284 | 20 | sleep(); |
chris | 0:7170e3ed7284 | 21 | } |
chris | 0:7170e3ed7284 | 22 | |
chris | 0:7170e3ed7284 | 23 | } |