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 Thread_Communication_V4_fortest by
Revision 18:728fddea6d9c, committed 2018-01-06
- Comitter:
- benparkes
- Date:
- Sat Jan 06 21:18:06 2018 +0000
- Parent:
- 17:aa585f901750
- Commit message:
- time with mail;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r aa585f901750 -r 728fddea6d9c main.cpp --- a/main.cpp Sat Jan 06 19:44:43 2018 +0000 +++ b/main.cpp Sat Jan 06 21:18:06 2018 +0000 @@ -172,7 +172,10 @@ // Keep short void sensorRead () { - + volatile float LDR = 0; + volatile double PRES = 0; + volatile double TEMP = 0; + while (1) { dataLock.lock(); // Entering Critial Section @@ -182,11 +185,6 @@ TEMP = Sensor.getTemperature(); PRES = Sensor.getPressure(); - memset((char *)TIME, NULL, 21); - time(&raw_time); - sample_epoch = localtime(&raw_time); - strftime((char *)TIME, 21,"%d/%m/%Y, %X", sample_epoch); - dataLock.unlock(); // Exiting Critical Section Green_int = !Green_int; // debugging @@ -750,8 +748,12 @@ if (evt.status == osEventMail) { mail_t *mail = (mail_t*)evt.value.p; - - sprintf(X_str,"%s, \n\rTemperature: %2.2f, \n\rPressure: %4.2f, \n\rLight: %.4f", mail->Time_Date, mail->temp_Value, mail->press_Value, mail->LDR_Value); + char sample_time[21]; + int rTime = mail->Time_Date; + time((time_t*)rTime); + sample_epoch = localtime((time_t*)rTime); + strftime(sample_time, 21,"%d/%m/%Y, %X", sample_epoch); + sprintf(X_str,"%s, \n\rTemperature: %2.2f, \n\rPressure: %4.2f, \n\rLight: %.4f", sample_time, mail->temp_Value, mail->press_Value, mail->LDR_Value); mail_Network.free(mail); }