
kadai3
main.cpp
- Committer:
- shunsaku000
- Date:
- 2022-08-03
- Revision:
- 0:bf12b5254bf3
File content as of revision 0:bf12b5254bf3:
#include "mbed.h" #include "TextLCD.h" TextLCD lcd(p24, p26, p27, p28, p29, p30); // rs, e, d4-d7 AnalogIn ain(p15); int main() { float adc, volts, N; while (1){ lcd.locate(0,0); adc = ain.read(); // read analog as a float volts = adc ; // convert to volts N = volts * 16 ; lcd.printf("%8.3f N\n", N); wait(0.05); // 20Hz update rate } }