Pallavi Sudhakar
/
TextLCD_ADC
ADC values ported on to LCD
Fork of TextLCD_HelloWorld by
main.cpp
- Committer:
- Pallavi
- Date:
- 2013-05-06
- Revision:
- 4:206beeaf992b
- Parent:
- 3:bae19bde97d5
File content as of revision 4:206beeaf992b:
// Hello World! for the TextLCD #include "mbed.h" #include "TextLCD.h" TextLCD lcd(p9, p10, p11, p12, p13, p14); // rs, e, d4-d7 AnalogIn voltage(p15); DigitalOut A(LED1); DigitalOut B(LED2); DigitalOut C(LED3); DigitalOut D(LED4); int main() { float x; while (1){ x=voltage.read(); lcd.printf(" voltage in real: %3.4f\n", voltage.read()); wait(1); lcd.printf("voltage in integer: %5d\n", voltage.read_u16()); wait(1); if(x<=0.2) { A=0; B=0; C=0; D=0; } else if(x>0.2 && x<=0.4) { A=1; B=0; C=0; D=0; } else if(x>0.4 && x<=0.6) { A=1; B=1; C=0; D=0; } else if(x>0.6 && x<=0.8) { A=1; B=1; C=1; D=0; } else if(x>0.8 && x<=1.0) { A=1; B=1; C=1; D=1; } } }