Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Final351CW_FINAL by
Diff: Components/components.cpp
- Revision:
- 9:e27b3f34de24
- Parent:
- 8:582ac4c5a524
- Child:
- 10:098c2fa0a1a6
diff -r 582ac4c5a524 -r e27b3f34de24 Components/components.cpp
--- a/Components/components.cpp Tue Jan 09 05:43:43 2018 +0000
+++ b/Components/components.cpp Tue Jan 09 06:14:41 2018 +0000
@@ -49,7 +49,6 @@
char TEM[6];
char PRE[5];
char LIGHT[6];
-//printf("REFRESH SENSORS\n\r");
sprintf(TEM,"%.2f", temp);
sprintf(PRE,"%.2f", pressure);
sprintf(LIGHT,"%.2f", lightin);
@@ -108,18 +107,6 @@
while(1)
{
Lock2.lock();
-double P = sensor.getPressure();
-double L = adcIn;
-double t = sensor.getTemperature();
-char tem[6];
-char pre[5];
-char light[6];
-char com[1];
-strcpy(com, ",");
-sprintf(pre,"%.2f", P);
-sprintf(tem,"%.2f",t);
-printf(tem);
-sprintf(light,"%.2f\n\r", L);
time_t seconds = time(NULL);
strftime(jdate1, 32, "%F", localtime(&seconds));
strftime(jdate, 32, "%F\n\r", localtime(&seconds));
@@ -131,6 +118,17 @@
strcpy(prefix,"/sd/");
strcpy(suffix,".txt");
Lock1.lock();
+double P = sensor.getPressure();
+double L = adcIn;
+double t = sensor.getTemperature();
+char tem[6];
+char pre[5];
+char light[6];
+char com[1];
+strcpy(com, ",");
+sprintf(pre,"%.2f", P);
+sprintf(tem,"%.2f",t);
+sprintf(light,"%.2f\n\r", L);
sprintf(filename,"%s%s%s",prefix,jdate1,suffix);
Lock1.unlock();
FILE* fp = fopen(filename,"a");
