este código permite cambiar los valores de las variables para el PID mediante un enconder, ademas pulsando el botón del mismo enconder, cambia la posición del cursor y se genera un sonido.
Dependencies: QEI TextLCD mbed
Fork of pid-TAREA4-ENCODER by
DebouncedIn.h@1:9ca362d07dd0, 2014-04-08 (annotated)
- Committer:
- lopjohn_26
- Date:
- Tue Apr 08 19:02:44 2014 +0000
- Revision:
- 1:9ca362d07dd0
- Parent:
- 0:dd68101b1b99
sonido del bot?n encoder
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Wilmar87 | 0:dd68101b1b99 | 1 | #include "mbed.h" |
Wilmar87 | 0:dd68101b1b99 | 2 | |
Wilmar87 | 0:dd68101b1b99 | 3 | class DebouncedIn { |
Wilmar87 | 0:dd68101b1b99 | 4 | public: |
Wilmar87 | 0:dd68101b1b99 | 5 | DebouncedIn(PinName in); |
Wilmar87 | 0:dd68101b1b99 | 6 | |
Wilmar87 | 0:dd68101b1b99 | 7 | int read (void); |
Wilmar87 | 0:dd68101b1b99 | 8 | operator int(); |
Wilmar87 | 0:dd68101b1b99 | 9 | |
Wilmar87 | 0:dd68101b1b99 | 10 | int rising(void); |
Wilmar87 | 0:dd68101b1b99 | 11 | int falling(void); |
Wilmar87 | 0:dd68101b1b99 | 12 | int steady(void); |
Wilmar87 | 0:dd68101b1b99 | 13 | |
Wilmar87 | 0:dd68101b1b99 | 14 | private : |
Wilmar87 | 0:dd68101b1b99 | 15 | // objects |
Wilmar87 | 0:dd68101b1b99 | 16 | DigitalIn _in; |
Wilmar87 | 0:dd68101b1b99 | 17 | Ticker _ticker; |
Wilmar87 | 0:dd68101b1b99 | 18 | |
Wilmar87 | 0:dd68101b1b99 | 19 | // function to take a sample, and update flags |
Wilmar87 | 0:dd68101b1b99 | 20 | void _sample(void); |
Wilmar87 | 0:dd68101b1b99 | 21 | |
Wilmar87 | 0:dd68101b1b99 | 22 | // counters and flags |
Wilmar87 | 0:dd68101b1b99 | 23 | int _samples; |
Wilmar87 | 0:dd68101b1b99 | 24 | int _output; |
Wilmar87 | 0:dd68101b1b99 | 25 | int _output_last; |
Wilmar87 | 0:dd68101b1b99 | 26 | int _rising_flag; |
Wilmar87 | 0:dd68101b1b99 | 27 | int _falling_flag; |
Wilmar87 | 0:dd68101b1b99 | 28 | int _state_counter; |
Wilmar87 | 0:dd68101b1b99 | 29 | |
Wilmar87 | 0:dd68101b1b99 | 30 | }; |
Wilmar87 | 0:dd68101b1b99 | 31 |