Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of read_analog by
Diff: main.cpp
- Revision:
- 0:140f2dc46122
- Child:
- 1:732610676e2e
diff -r 000000000000 -r 140f2dc46122 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Jul 11 09:28:45 2018 +0000 @@ -0,0 +1,17 @@ +#include "mbed.h" + +AnalogIn analog_value(dp13); + +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; // for TMP36GT9Z + printf("measure = %.0f mV, temp = %.1f C\r\n", meas, temp); + wait(0.2); // 200 ms + } +} +