Yosef Guevara Salamanca
/
pulsador_led
Pruebas del pulsador funcionando / por alguna razon no funcionan D0/D1
pulsardo_led.cpp@0:e96339ce40ec, 2018-10-01 (annotated)
- Committer:
- djinn77
- Date:
- Mon Oct 01 05:58:32 2018 +0000
- Revision:
- 0:e96339ce40ec
Pruebas de pulsador funcionando
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
djinn77 | 0:e96339ce40ec | 1 | |
djinn77 | 0:e96339ce40ec | 2 | #include "mbed.h" |
djinn77 | 0:e96339ce40ec | 3 | |
djinn77 | 0:e96339ce40ec | 4 | DigitalOut led1(D2); // conector arduino |
djinn77 | 0:e96339ce40ec | 5 | DigitalOut led2(D3); // conector arduino |
djinn77 | 0:e96339ce40ec | 6 | DigitalIn pulsador1(A5); //pulsador conector Arduino |
djinn77 | 0:e96339ce40ec | 7 | DigitalIn pulsador2(A4); //pulsador conector Arduino |
djinn77 | 0:e96339ce40ec | 8 | |
djinn77 | 0:e96339ce40ec | 9 | int main() { |
djinn77 | 0:e96339ce40ec | 10 | |
djinn77 | 0:e96339ce40ec | 11 | while(1) { |
djinn77 | 0:e96339ce40ec | 12 | if(pulsador1 ==1){ |
djinn77 | 0:e96339ce40ec | 13 | led1= 1; |
djinn77 | 0:e96339ce40ec | 14 | }else{ |
djinn77 | 0:e96339ce40ec | 15 | led1=0; |
djinn77 | 0:e96339ce40ec | 16 | } |
djinn77 | 0:e96339ce40ec | 17 | if(pulsador2 ==1){ |
djinn77 | 0:e96339ce40ec | 18 | led2= 1; |
djinn77 | 0:e96339ce40ec | 19 | }else{ |
djinn77 | 0:e96339ce40ec | 20 | led2=0; |
djinn77 | 0:e96339ce40ec | 21 | } |
djinn77 | 0:e96339ce40ec | 22 | } |
djinn77 | 0:e96339ce40ec | 23 | } |