![](/media/cache/group/WeatherStation.jpg.50x50_q85.jpg)
test receiver for weather peeps
Dependencies: LCDTFT_ssd0139 mbed
Diff: main.cpp
- Revision:
- 2:c773fddffb50
- Parent:
- 1:a1c10567ccf0
--- a/main.cpp Fri Jun 12 11:25:43 2015 +0000 +++ b/main.cpp Fri Jun 12 13:19:27 2015 +0000 @@ -21,6 +21,8 @@ float temperature = 45; float light = 100; +float pressure; +float humidity; char message[20]; @@ -138,12 +140,11 @@ if ( c == 'P') { // end of pressure data MyLCD.vLCDTFTSetParametersPrintf(5,220,0,320,2,Black,Cyan); - MyLCD.printf("Pressure: "); + + sscanf(message,"%f",&pressure); // convert string to float + MyLCD.printf("Pressure: %5.2f",pressure); - for (int j =0;j<i-1;j++) { // to print the pressure data character by character - MyLCD.printf("%c",message[j]); - } - + i=0; wait(1); } @@ -154,14 +155,12 @@ if ( c == 'H') { // end of humidity data - MyLCD.vLCDTFTSetParametersPrintf(5,160,0,320,2,Black,Cyan); - MyLCD.printf("Humidity: "); + MyLCD.vLCDTFTSetParametersPrintf(5,160,0,320,2,Black,Cyan); + + sscanf(message,"%f",&humidity); // convert string to float + MyLCD.printf("Humidity: %5.2f",humidity); - for (int j =0;j<i-1;j++) { // print to the humidity data character by character - MyLCD.printf("%c",message[j]); - } - - MyLCD.printf("\n\r"); + //MyLCD.printf("\n\r"); i=0; wait(1); }