hin you / Mbed 2 deprecated Pressure

Dependencies:   TextLCD mbed

Committer:
youhinclark
Date:
Mon Aug 03 10:31:13 2015 +0000
Revision:
1:21f25a711f29
Parent:
0:d86587ed9b1c
Pressure

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hasimo 0:d86587ed9b1c 1 #include "mbed.h"
hasimo 0:d86587ed9b1c 2 #include "TextLCD.h"
hasimo 0:d86587ed9b1c 3
hasimo 0:d86587ed9b1c 4 TextLCD lcd(p24, p26, p27, p28, p29, p30); // rs, e, d4-d7
hasimo 0:d86587ed9b1c 5 AnalogIn ain(p15);
hasimo 0:d86587ed9b1c 6
hasimo 0:d86587ed9b1c 7 int main() {
hasimo 0:d86587ed9b1c 8 float adc;
hasimo 0:d86587ed9b1c 9
hasimo 0:d86587ed9b1c 10 while (1){
youhinclark 1:21f25a711f29 11 adc=ain.read();
youhinclark 1:21f25a711f29 12 adc*=3.3;
youhinclark 1:21f25a711f29 13 adc=250/((3.5-adc)*(3.5-adc));
hasimo 0:d86587ed9b1c 14 lcd.locate(0,0);
youhinclark 1:21f25a711f29 15 lcd.printf("%8.3f \n", adc);
hasimo 0:d86587ed9b1c 16 wait(0.05); // 20Hz update rate
hasimo 0:d86587ed9b1c 17 }
hasimo 0:d86587ed9b1c 18 }