los primeros ejers con ticker
Dependencies: mbed
main.cpp@0:e64057ed9080, 2019-04-09 (annotated)
- Committer:
- Franmaver
- Date:
- Tue Apr 09 14:01:44 2019 +0000
- Revision:
- 0:e64057ed9080
toma el 2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Franmaver | 0:e64057ed9080 | 1 | #include "mbed.h" |
Franmaver | 0:e64057ed9080 | 2 | //Hacer parpadear un led verde cada 0.25s con ticker |
Franmaver | 0:e64057ed9080 | 3 | |
Franmaver | 0:e64057ed9080 | 4 | DigitalOut myled(LED2); |
Franmaver | 0:e64057ed9080 | 5 | Ticker charin; |
Franmaver | 0:e64057ed9080 | 6 | void mav(); |
Franmaver | 0:e64057ed9080 | 7 | |
Franmaver | 0:e64057ed9080 | 8 | int main() { |
Franmaver | 0:e64057ed9080 | 9 | |
Franmaver | 0:e64057ed9080 | 10 | charin.attach(&mav, 0.25); |
Franmaver | 0:e64057ed9080 | 11 | |
Franmaver | 0:e64057ed9080 | 12 | while(1) { |
Franmaver | 0:e64057ed9080 | 13 | } |
Franmaver | 0:e64057ed9080 | 14 | } |
Franmaver | 0:e64057ed9080 | 15 | void mav () { |
Franmaver | 0:e64057ed9080 | 16 | myled = !myled; |
Franmaver | 0:e64057ed9080 | 17 | } |