Jan Martin
/
actividad_1
UNAL_Procesadores Actividad 1
main.cpp@0:7f5c273fe35a, 2019-10-09 (annotated)
- Committer:
- contechno
- Date:
- Wed Oct 09 17:21:15 2019 +0000
- Revision:
- 0:7f5c273fe35a
UNAL_Procesadores; Actividad 1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
contechno | 0:7f5c273fe35a | 1 | #include "mbed.h" |
contechno | 0:7f5c273fe35a | 2 | |
contechno | 0:7f5c273fe35a | 3 | DigitalOut red(LED1); //red |
contechno | 0:7f5c273fe35a | 4 | DigitalOut green(LED2); //Green |
contechno | 0:7f5c273fe35a | 5 | DigitalOut blue(LED3); //Blue |
contechno | 0:7f5c273fe35a | 6 | |
contechno | 0:7f5c273fe35a | 7 | int main() { |
contechno | 0:7f5c273fe35a | 8 | |
contechno | 0:7f5c273fe35a | 9 | // Reset all LEDs to off (LEDs are low-active) |
contechno | 0:7f5c273fe35a | 10 | red = 1; |
contechno | 0:7f5c273fe35a | 11 | green = 1; |
contechno | 0:7f5c273fe35a | 12 | blue = 1; |
contechno | 0:7f5c273fe35a | 13 | |
contechno | 0:7f5c273fe35a | 14 | while(1) { |
contechno | 0:7f5c273fe35a | 15 | |
contechno | 0:7f5c273fe35a | 16 | //light red LED 1s |
contechno | 0:7f5c273fe35a | 17 | red = 0; |
contechno | 0:7f5c273fe35a | 18 | wait(1); |
contechno | 0:7f5c273fe35a | 19 | red = 1; |
contechno | 0:7f5c273fe35a | 20 | |
contechno | 0:7f5c273fe35a | 21 | //light green LED 1s |
contechno | 0:7f5c273fe35a | 22 | green = 0; |
contechno | 0:7f5c273fe35a | 23 | wait(1); |
contechno | 0:7f5c273fe35a | 24 | green = 1; |
contechno | 0:7f5c273fe35a | 25 | |
contechno | 0:7f5c273fe35a | 26 | //light blue LED 1s |
contechno | 0:7f5c273fe35a | 27 | blue = 0; |
contechno | 0:7f5c273fe35a | 28 | wait(1); |
contechno | 0:7f5c273fe35a | 29 | blue = 1; |
contechno | 0:7f5c273fe35a | 30 | |
contechno | 0:7f5c273fe35a | 31 | //light red and green (=yellow) LEDs 1s |
contechno | 0:7f5c273fe35a | 32 | red = 0; |
contechno | 0:7f5c273fe35a | 33 | green = 0; |
contechno | 0:7f5c273fe35a | 34 | wait(1); |
contechno | 0:7f5c273fe35a | 35 | red = 1; |
contechno | 0:7f5c273fe35a | 36 | green = 1; |
contechno | 0:7f5c273fe35a | 37 | |
contechno | 0:7f5c273fe35a | 38 | //light red and blue (=magenta) LEDs 1s |
contechno | 0:7f5c273fe35a | 39 | red = 0; |
contechno | 0:7f5c273fe35a | 40 | blue = 0; |
contechno | 0:7f5c273fe35a | 41 | wait(1); |
contechno | 0:7f5c273fe35a | 42 | red = 1; |
contechno | 0:7f5c273fe35a | 43 | blue = 1; |
contechno | 0:7f5c273fe35a | 44 | |
contechno | 0:7f5c273fe35a | 45 | //light blue and green (=cyan) LEDs 1s |
contechno | 0:7f5c273fe35a | 46 | blue = 0; |
contechno | 0:7f5c273fe35a | 47 | green = 0; |
contechno | 0:7f5c273fe35a | 48 | wait(1); |
contechno | 0:7f5c273fe35a | 49 | blue = 1; |
contechno | 0:7f5c273fe35a | 50 | green = 1; |
contechno | 0:7f5c273fe35a | 51 | } |
contechno | 0:7f5c273fe35a | 52 | } |