Seongbin Lim
/
sb_first_project
This is a very simple guide, reviewing the steps required to get Blinky working on an Mbed OS platform.
Diff: main.cpp
- Revision:
- 124:acd4e55881bd
- Parent:
- 123:c9734480ca03
- Child:
- 125:bcf7bc3120f5
--- a/main.cpp Tue Apr 21 00:34:57 2020 +0000 +++ b/main.cpp Tue Apr 21 00:40:10 2020 +0000 @@ -1,19 +1,19 @@ #include "mbed.h" #include <string.h> -AnalogIn aIn0(A0); RawSerial pc(PA_2, PA_3,115200); +AnalogIn tempSensor(ADC_TEMP); int main() { float meas; - pc.printf("Welcome to AnalogIn Lab!\r\n"); + pc.printf("Welcome to ADC Example!\r\n"); while(true) { - meas = aIn0.read(); - meas = meas * 3300; - pc.printf("A0 input voltage = %fmV\r\n", meas); - ThisThread::sleep_for(1000); + meas = tempSensor.read(); + meas = 25.0 + (3300.0 * meas - 760.0)/2.5; + pc.printf("Internal Temperature = %.2f [C]\r\n", meas); + ThisThread::sleep_for(5000); } } \ No newline at end of file