Práctica 2 Ejercicio 6
Dependencies: mbed
main.cpp@0:c454cf4fb510, 2017-11-03 (annotated)
- Committer:
- anderibabe
- Date:
- Fri Nov 03 14:23:57 2017 +0000
- Revision:
- 0:c454cf4fb510
Pr?ctica 2 Ejercicio 6
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
anderibabe | 0:c454cf4fb510 | 1 | #include "mbed.h" |
anderibabe | 0:c454cf4fb510 | 2 | |
anderibabe | 0:c454cf4fb510 | 3 | Timer timer1; |
anderibabe | 0:c454cf4fb510 | 4 | Timer timer2; |
anderibabe | 0:c454cf4fb510 | 5 | Timer timer3; |
anderibabe | 0:c454cf4fb510 | 6 | DigitalOut Led1(PB_3); // Led1 conectado al pin D3 |
anderibabe | 0:c454cf4fb510 | 7 | DigitalOut Led2(PB_5); // Led2 conectado al pin D4 |
anderibabe | 0:c454cf4fb510 | 8 | DigitalOut Led3(PB_4); // Led3 conectado al pin D5 |
anderibabe | 0:c454cf4fb510 | 9 | int cont1,cont2,cont3,end1,end2,end3; |
anderibabe | 0:c454cf4fb510 | 10 | |
anderibabe | 0:c454cf4fb510 | 11 | int main() |
anderibabe | 0:c454cf4fb510 | 12 | { |
anderibabe | 0:c454cf4fb510 | 13 | timer1.start(); |
anderibabe | 0:c454cf4fb510 | 14 | timer2.start(); |
anderibabe | 0:c454cf4fb510 | 15 | timer3.start(); |
anderibabe | 0:c454cf4fb510 | 16 | cont1= timer1.read.us(); //tiempo pasado en ms |
anderibabe | 0:c454cf4fb510 | 17 | cont2= timer1.read.us(); //tiempo pasado en ms |
anderibabe | 0:c454cf4fb510 | 18 | cont3= timer1.read.us(); //tiempo pasado en ms |
anderibabe | 0:c454cf4fb510 | 19 | end1=; // Frecuencia 1s |
anderibabe | 0:c454cf4fb510 | 20 | end2=; // Frecuencia 1,2s |
anderibabe | 0:c454cf4fb510 | 21 | end3=; // Frecuencia 1,5s |
anderibabe | 0:c454cf4fb510 | 22 | while(1) { |
anderibabe | 0:c454cf4fb510 | 23 | if (cont1=end1) |
anderibabe | 0:c454cf4fb510 | 24 | { |
anderibabe | 0:c454cf4fb510 | 25 | |
anderibabe | 0:c454cf4fb510 | 26 | } |
anderibabe | 0:c454cf4fb510 | 27 | wait(1); |
anderibabe | 0:c454cf4fb510 | 28 | } |
anderibabe | 0:c454cf4fb510 | 29 | } |