
kadai3
Revision 0:bf12b5254bf3, committed 2022-08-03
- Comitter:
- shunsaku000
- Date:
- Wed Aug 03 08:08:53 2022 +0000
- Commit message:
- pressuresensor;
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Wed Aug 03 08:08:53 2022 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/TextLCD/#308d188a2d3a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Aug 03 08:08:53 2022 +0000 @@ -0,0 +1,20 @@ +#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 + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Aug 03 08:08:53 2022 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file