WS-for-Teachers (2019) / Mbed 2 deprecated read_analog_ws

Dependencies:   mbed

Fork of read_analog by 卒研ゼミ (2018)

Committer:
yokotay
Date:
Wed Jul 11 09:28:45 2018 +0000
Revision:
0:140f2dc46122
Child:
1:732610676e2e
init

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yokotay 0:140f2dc46122 1 #include "mbed.h"
yokotay 0:140f2dc46122 2
yokotay 0:140f2dc46122 3 AnalogIn analog_value(dp13);
yokotay 0:140f2dc46122 4
yokotay 0:140f2dc46122 5 int main(void)
yokotay 0:140f2dc46122 6 {
yokotay 0:140f2dc46122 7 float meas, temp;
yokotay 0:140f2dc46122 8 printf("\r\nAnalogIn example\r\n");
yokotay 0:140f2dc46122 9 while(1) {
yokotay 0:140f2dc46122 10 meas = analog_value.read(); // Converts and read the analog input value (value from 0.0 to 1.0)
yokotay 0:140f2dc46122 11 meas = meas * 3300; // Change the value to be in the 0 to 3300 range (mV)
yokotay 0:140f2dc46122 12 temp = 0.1 * meas - 50; // for TMP36GT9Z
yokotay 0:140f2dc46122 13 printf("measure = %.0f mV, temp = %.1f C\r\n", meas, temp);
yokotay 0:140f2dc46122 14 wait(0.2); // 200 ms
yokotay 0:140f2dc46122 15 }
yokotay 0:140f2dc46122 16 }
yokotay 0:140f2dc46122 17