LED_RED=SW1 LED_GREEN=SW3
Dependencies: mbed
main.cpp@0:d4d584f5e8fe, 2014-03-13 (annotated)
- Committer:
- rcortes
- Date:
- Thu Mar 13 19:54:49 2014 +0000
- Revision:
- 0:d4d584f5e8fe
LED_RED = SW1 ; LED_GREEN =SW3
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rcortes | 0:d4d584f5e8fe | 1 | //Programa para encender los leds rojo y verde al oprimir los botones SW1 y SW2 |
rcortes | 0:d4d584f5e8fe | 2 | #include "mbed.h" |
rcortes | 0:d4d584f5e8fe | 3 | #define OFF 1 |
rcortes | 0:d4d584f5e8fe | 4 | |
rcortes | 0:d4d584f5e8fe | 5 | DigitalOut redled(LED_RED); |
rcortes | 0:d4d584f5e8fe | 6 | DigitalOut greenled(LED_GREEN); |
rcortes | 0:d4d584f5e8fe | 7 | DigitalIn sw3(PTC12); |
rcortes | 0:d4d584f5e8fe | 8 | DigitalIn sw1(PTC3); |
rcortes | 0:d4d584f5e8fe | 9 | int main() |
rcortes | 0:d4d584f5e8fe | 10 | { |
rcortes | 0:d4d584f5e8fe | 11 | greenled = OFF; //green and red led are off |
rcortes | 0:d4d584f5e8fe | 12 | redled = OFF; |
rcortes | 0:d4d584f5e8fe | 13 | while(1) { |
rcortes | 0:d4d584f5e8fe | 14 | greenled=sw3; //green led is SW3 |
rcortes | 0:d4d584f5e8fe | 15 | redled=sw1; // red led is SW1 |
rcortes | 0:d4d584f5e8fe | 16 | } |
rcortes | 0:d4d584f5e8fe | 17 | } |