probando el micro
Dependencies: mbed
main.cpp@0:ea5cf5fc3581, 2019-04-09 (annotated)
- Committer:
- Franmaver
- Date:
- Tue Apr 09 14:07:27 2019 +0000
- Revision:
- 0:ea5cf5fc3581
el 4. de lo mismo tambien
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Franmaver | 0:ea5cf5fc3581 | 1 | #include "mbed.h" |
Franmaver | 0:ea5cf5fc3581 | 2 | |
Franmaver | 0:ea5cf5fc3581 | 3 | DigitalOut rojo(LED1); |
Franmaver | 0:ea5cf5fc3581 | 4 | DigitalOut verde(LED2); |
Franmaver | 0:ea5cf5fc3581 | 5 | Ticker charo; |
Franmaver | 0:ea5cf5fc3581 | 6 | void mav(){ |
Franmaver | 0:ea5cf5fc3581 | 7 | static int i = 0, vez = 0; |
Franmaver | 0:ea5cf5fc3581 | 8 | rojo = 1; |
Franmaver | 0:ea5cf5fc3581 | 9 | verde = 1; |
Franmaver | 0:ea5cf5fc3581 | 10 | i++; |
Franmaver | 0:ea5cf5fc3581 | 11 | if(i == 9){ |
Franmaver | 0:ea5cf5fc3581 | 12 | rojo = 0; |
Franmaver | 0:ea5cf5fc3581 | 13 | i = 0; |
Franmaver | 0:ea5cf5fc3581 | 14 | vez++; |
Franmaver | 0:ea5cf5fc3581 | 15 | } |
Franmaver | 0:ea5cf5fc3581 | 16 | |
Franmaver | 0:ea5cf5fc3581 | 17 | if((i == 2) && (vez == 5)){ |
Franmaver | 0:ea5cf5fc3581 | 18 | verde = 0; |
Franmaver | 0:ea5cf5fc3581 | 19 | i = 0; |
Franmaver | 0:ea5cf5fc3581 | 20 | vez = 0; |
Franmaver | 0:ea5cf5fc3581 | 21 | } |
Franmaver | 0:ea5cf5fc3581 | 22 | |
Franmaver | 0:ea5cf5fc3581 | 23 | } |
Franmaver | 0:ea5cf5fc3581 | 24 | int main() { |
Franmaver | 0:ea5cf5fc3581 | 25 | charo.attach(&mav, 0.1); |
Franmaver | 0:ea5cf5fc3581 | 26 | while(1) { |
Franmaver | 0:ea5cf5fc3581 | 27 | } |
Franmaver | 0:ea5cf5fc3581 | 28 | } |