alex Garcia Blanco
/
mbed_LandTiger_LEDS
/*Simple program to exercise the LEDs * For the LandTiger Board
main.cpp@0:a2e3d8ae0a8c, 2016-03-12 (annotated)
- Committer:
- alex_G_blanco
- Date:
- Sat Mar 12 01:20:44 2016 +0000
- Revision:
- 0:a2e3d8ae0a8c
/*Simple program to exercise the LEDs; * For the LandTiger Board
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
alex_G_blanco | 0:a2e3d8ae0a8c | 1 | /*Simple program to exercise the LEDs |
alex_G_blanco | 0:a2e3d8ae0a8c | 2 | * For the LandTiger Board |
alex_G_blanco | 0:a2e3d8ae0a8c | 3 | */ |
alex_G_blanco | 0:a2e3d8ae0a8c | 4 | |
alex_G_blanco | 0:a2e3d8ae0a8c | 5 | #include "mbed.h" |
alex_G_blanco | 0:a2e3d8ae0a8c | 6 | |
alex_G_blanco | 0:a2e3d8ae0a8c | 7 | //Create a Bus with the 8 LEDS. Pins corresponds to LD4 to LD11 |
alex_G_blanco | 0:a2e3d8ae0a8c | 8 | BusOut LEDS(P2_7, P2_6, P2_5, P2_4, P2_3, P2_2, P2_1, P2_0); |
alex_G_blanco | 0:a2e3d8ae0a8c | 9 | |
alex_G_blanco | 0:a2e3d8ae0a8c | 10 | int main() { |
alex_G_blanco | 0:a2e3d8ae0a8c | 11 | while(1) { |
alex_G_blanco | 0:a2e3d8ae0a8c | 12 | //cycle the LEDS in bynary order |
alex_G_blanco | 0:a2e3d8ae0a8c | 13 | for(int i=0; i<=256; i++) { //8 bits |
alex_G_blanco | 0:a2e3d8ae0a8c | 14 | LEDS = i; //assign value to bus, turns on LEDS in hexa mode |
alex_G_blanco | 0:a2e3d8ae0a8c | 15 | wait(0.1); //timer of the LEDS sequence |
alex_G_blanco | 0:a2e3d8ae0a8c | 16 | } |
alex_G_blanco | 0:a2e3d8ae0a8c | 17 | } |
alex_G_blanco | 0:a2e3d8ae0a8c | 18 | } |