Display Pressure and Temperature readings from the SCP1000 on uLCD
Dependencies: 4DGL-uLCD-SE SCP1000 mbed
main.cpp@0:24462f386127, 2014-10-20 (annotated)
- Committer:
- sdhingra
- Date:
- Mon Oct 20 00:26:24 2014 +0000
- Revision:
- 0:24462f386127
SCP1000 uLCD Display
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sdhingra | 0:24462f386127 | 1 | // Hello World! for the SCP1000 |
sdhingra | 0:24462f386127 | 2 | |
sdhingra | 0:24462f386127 | 3 | #include "mbed.h" |
sdhingra | 0:24462f386127 | 4 | #include "uLCD_4DGL.h" |
sdhingra | 0:24462f386127 | 5 | #include "SCP1000.h" |
sdhingra | 0:24462f386127 | 6 | |
sdhingra | 0:24462f386127 | 7 | uLCD_4DGL uLCD(p28, p27, p11); // create a global lcd object |
sdhingra | 0:24462f386127 | 8 | SCP1000 scp1000(p5,p6,p7,p8); |
sdhingra | 0:24462f386127 | 9 | |
sdhingra | 0:24462f386127 | 10 | float myTemp; |
sdhingra | 0:24462f386127 | 11 | float myPressure; |
sdhingra | 0:24462f386127 | 12 | |
sdhingra | 0:24462f386127 | 13 | int main() { |
sdhingra | 0:24462f386127 | 14 | while (true) { |
sdhingra | 0:24462f386127 | 15 | uLCD.locate(0,2); |
sdhingra | 0:24462f386127 | 16 | uLCD.printf("SCP1000 Demo!"); |
sdhingra | 0:24462f386127 | 17 | myTemp = scp1000.readTemperature(); |
sdhingra | 0:24462f386127 | 18 | myPressure = scp1000.readPressure(); |
sdhingra | 0:24462f386127 | 19 | uLCD.locate(0,5); |
sdhingra | 0:24462f386127 | 20 | uLCD.printf("Temp(C):\n %.3f", myTemp); |
sdhingra | 0:24462f386127 | 21 | uLCD.locate(0,8); |
sdhingra | 0:24462f386127 | 22 | uLCD.printf("Pressure(Pa):\n %.2f", myPressure); |
sdhingra | 0:24462f386127 | 23 | wait(0.5); |
sdhingra | 0:24462f386127 | 24 | } |
sdhingra | 0:24462f386127 | 25 | } |
sdhingra | 0:24462f386127 | 26 |