![](/media/cache/group/139-01.png.50x50_q85.png)
arito kadai2
Dependencies: mbed
Revision 0:9fd31ece983a, committed 2018-07-20
- Comitter:
- arito
- Date:
- Fri Jul 20 04:40:35 2018 +0000
- Commit message:
- kadai2 arito
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Jul 20 04:40:35 2018 +0000 @@ -0,0 +1,26 @@ +#include "mbed.h" + +AnalogIn analog_value(dp13); +PwmOut led(dp24); + +int main(void) +{ + float meas, temp; + printf("\r\nAnalogIn example\r\n"); + while(1) { + meas = analog_value.read(); // Converts and read the analog input value (value from 0.0 to 1.0) + meas = meas * 3300; // Change the value to be in the 0 to 3300 range (mV) + temp = 0.1 * meas - 50; + if( temp > 15.0){ + led = 1; + led.period(4.0f); + led.write(0.5f); + } + else{ + led = 0; + wait(1.0); + } + printf("measure = %.0f mV, temp = %.1f C\r\n", meas, temp); + wait(0.2); // 200 ms + } + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Jul 20 04:40:35 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a7c7b631e539 \ No newline at end of file