Usage of Hysteresis library and sample code with LED.
Dependencies: HysteresisIn mbed
main.cpp@0:5913813b85d9, 2016-06-05 (annotated)
- Committer:
- SIT2016
- Date:
- Sun Jun 05 13:15:22 2016 +0000
- Revision:
- 0:5913813b85d9
Usage of Hysteresis library and sample code with LED.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
SIT2016 | 0:5913813b85d9 | 1 | #include "mbed.h" |
SIT2016 | 0:5913813b85d9 | 2 | #include "HysteresisIn.h" |
SIT2016 | 0:5913813b85d9 | 3 | |
SIT2016 | 0:5913813b85d9 | 4 | //analog pin, two thresholds and initial state |
SIT2016 | 0:5913813b85d9 | 5 | HysteresisIn hy(PTB0, 0.3, 0.7, 0); |
SIT2016 | 0:5913813b85d9 | 6 | DigitalOut led(PTA5); |
SIT2016 | 0:5913813b85d9 | 7 | |
SIT2016 | 0:5913813b85d9 | 8 | int main() { |
SIT2016 | 0:5913813b85d9 | 9 | while(1) { |
SIT2016 | 0:5913813b85d9 | 10 | led = hy.read(); //boolean value |
SIT2016 | 0:5913813b85d9 | 11 | wait(1); |
SIT2016 | 0:5913813b85d9 | 12 | |
SIT2016 | 0:5913813b85d9 | 13 | } |
SIT2016 | 0:5913813b85d9 | 14 | } |
SIT2016 | 0:5913813b85d9 | 15 |