temp adc and preesure on lcd 20*4 also 16*4
Dependencies: KS0108 SCP1000 TextLCD mbed
Fork of TextLCD_ADC by
Revision 5:746a38bc5a10, committed 2013-08-28
- Comitter:
- drrifat
- Date:
- Wed Aug 28 18:34:41 2013 +0000
- Parent:
- 4:206beeaf992b
- Commit message:
- scp1000 pressure sensor read pressure and temp, show 16x4 lcd
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/KS0108.lib Wed Aug 28 18:34:41 2013 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/DimiterK/code/KS0108/#e4b50f4c13a8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SCP1000.lib Wed Aug 28 18:34:41 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/kadams6/code/SCP1000/#47d6f205890b
--- a/main.cpp Mon May 06 07:26:47 2013 +0000 +++ b/main.cpp Wed Aug 28 18:34:41 2013 +0000 @@ -1,57 +1,34 @@ -// Hello World! for the TextLCD +#include "SCP1000.h" +#include "mbed.h" +#include "TextLCD.h" -#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); +TextLCD lcd(p26, p25, p24, p23, p22, p21,TextLCD::LCD20x4); // rs, e, d4-d7 + +SCP1000 scp1000(p5,p6,p7,p8); +AnalogIn ain (p20); + +//Serial rn42(p9,p10); + + 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; - } + rn42.baud(57600); + lcd.locate(0, 0); + lcd.printf("This is version 1.0\n"); + lcd.locate(0, 1); + lcd.printf("of the spi host test\n"); + wait(0.75); + lcd.cls(); + while (1){ + + lcd.locate(0, 0); + lcd.printf("%.2f\n", ain.read()); + lcd.locate(0, 1); + lcd.printf("%d Pa ", scp1000.readPressure()); + lcd.locate(0, 2); + lcd.printf("%f C", scp1000.readTemperature()); + + } + } -}