Usage of Hysteresis library and sample code with LED.

Dependencies:   HysteresisIn mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "HysteresisIn.h"
00003 
00004 //analog pin, two thresholds and initial state 
00005 HysteresisIn hy(PTB0, 0.3, 0.7, 0); 
00006 DigitalOut led(PTA5);
00007 
00008 int main() {
00009     while(1) {
00010         led = hy.read(); //boolean value
00011         wait(1);
00012     
00013     }
00014 }
00015