Supachai Vorapojpisut
/
le484_2016
Course project for LE484 at Thammasat University, class of 2016
sensorTask.cpp@12:845639da2f03, 2017-05-08 (annotated)
- Committer:
- vsupacha
- Date:
- Mon May 08 05:11:22 2017 +0000
- Revision:
- 12:845639da2f03
- Parent:
- 9:5b4959a735a1
Fix wrong code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
3ecauz | 7:d702abfe51e3 | 1 | #include "mbed.h" |
3ecauz | 7:d702abfe51e3 | 2 | #include "platform.h" |
3ecauz | 7:d702abfe51e3 | 3 | |
3ecauz | 7:d702abfe51e3 | 4 | AnalogIn analog_value(A0); |
3ecauz | 7:d702abfe51e3 | 5 | |
3ecauz | 8:12d666d1afb4 | 6 | void sensorIn() |
3ecauz | 8:12d666d1afb4 | 7 | { |
3ecauz | 7:d702abfe51e3 | 8 | float meas; |
3ecauz | 8:12d666d1afb4 | 9 | |
3ecauz | 7:d702abfe51e3 | 10 | while(1) { |
3ecauz | 7:d702abfe51e3 | 11 | meas = analog_value.read(); |
3ecauz | 8:12d666d1afb4 | 12 | meas = meas * 3300; |
3ecauz | 7:d702abfe51e3 | 13 | printf("measure = %.0f mV\n", meas); |
3ecauz | 8:12d666d1afb4 | 14 | |
3ecauz | 7:d702abfe51e3 | 15 | } |
3ecauz | 8:12d666d1afb4 | 16 | } |