Supachai Vorapojpisut
/
le484_2016
Course project for LE484 at Thammasat University, class of 2016
Diff: sensorTask.cpp
- Revision:
- 7:d702abfe51e3
- Child:
- 8:12d666d1afb4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sensorTask.cpp Mon May 08 04:42:04 2017 +0000 @@ -0,0 +1,21 @@ +#include "mbed.h" +#include "platform.h" + +AnalogIn analog_value(A0); +DigitalOut led(LED1); + +void sensorIn() { + float meas; + + while(1) { + meas = analog_value.read(); + meas = meas * 3300; + printf("measure = %.0f mV\n", meas); + if (meas > 2000){ + led = 1; + } + else + led = 0; + wait(0.2); + } + }