CPS_Lab*
/
Lab9
initial
Revision 4:e0e55d90dbae, committed 2018-04-10
- Comitter:
- youngs2
- Date:
- Tue Apr 10 20:08:34 2018 +0000
- Parent:
- 3:b0a68b7daedb
- Commit message:
- lab 9 final
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r b0a68b7daedb -r e0e55d90dbae main.cpp --- a/main.cpp Fri Apr 06 16:55:48 2018 +0000 +++ b/main.cpp Tue Apr 10 20:08:34 2018 +0000 @@ -33,9 +33,6 @@ else pc.printf("Nope#2\n\r"); if(at.send("AT+NK=1,MTCDT-19400691") && 1) - //&& at.recv("Set Network Passphrase: MTCDT-19400691") - //&& at.recv("\n\r") - //&& at.recv("OK")) pc.printf("Bueno #3\n\r"); else pc.printf("Nope #3\n\r"); @@ -53,48 +50,30 @@ pc.printf("Bueno#6\n\r"); else pc.printf("Nope #6\n\r"); - - double pressure = pressure_sensor.getPressure(); - double temperature = pressure_sensor.getTemperature(); - - - pc.printf("temp = %lf\n\r", temperature); - pc.printf("pressure = %lf\n\r", pressure); - - char temp[9]; - char press[10]; - - int n; - - n = sprintf(temp, "%lf", temperature); - n = sprintf(press, "%lf", pressure); - pc.printf("It worked: %s\n\r", press); - /* - if(at.send("AT+SEND=\"%s\"", temp) && 1) - pc.printf("Bueno #7\n\r"); - else - pc.printf("Nope #7\n\r"); - */ - if(at.send("AT+SEND=\"%s\"",press) && 1) - pc.printf("Bueno #9\n\r"); - else - pc.printf("Nope #9\n\r"); - while(1); + while(1) + { + double pressure = pressure_sensor.getPressure(); + double temperature = pressure_sensor.getTemperature(); + //pc.printf("temp = %lf\n\r", temperature); + //pc.printf("pressure = %lf\n\r", pressure); + char temp[5]; + char press[6]; + int n; + n = sprintf(temp, "%.2lf", temperature); + n = sprintf(press, "%.2lf", pressure); + //pc.printf("Transfer worked: %s\n\r", press); + if(at.send("AT+SEND=\"%s\"", temp) && 1) + pc.printf("sent temp\n\r"); + else + pc.printf("didn't send temp #7\n\r"); + if(at.send("AT+SEND=\"%s\"", press) && 1) + pc.printf("sent pressure\n\r"); + else + pc.printf("didn't send pressure\n\r"); + wait(3600); + } } - - - - - - - - - - - - - /* Bryce code for getting Device ID memset(address, 0, 100);