![](/media/cache/profiles/acab0116c354964a558e65bdd07ff047.jpg.50x50_q85.jpg)
Syggestions
Dependencies: CheckRTC LPS25H hts221
Fork of ELEC350-extended-referral2 by
Diff: main.cpp
- Revision:
- 42:4bf55ab88fbc
- Parent:
- 41:ce3d6fb38d3b
- Child:
- 43:a9682b81632b
--- a/main.cpp Fri Nov 17 14:40:45 2017 +0000 +++ b/main.cpp Tue Nov 21 17:13:45 2017 +0000 @@ -62,6 +62,8 @@ string buffer_str(buffer); char date [32]; strftime(date, 32, "%Y/%m/%d %a", localtime(&seconds)); + char time [32]; + strftime(time, 32, "%H:%M:%S %p", localtime(&seconds)); if(buffer_str=="READALL") { humidity.ReadTempHumi(&tempCelsius, &humi); // reads temperature and humity levels @@ -69,12 +71,13 @@ // displays all the variables of time, date, temperature, humidity and all the barometric readings to the serial printf("%s, %s, %4.2fC , %3.1f%%, %6.1f, %4.1f\n\r", time, date, tempCelsius, humi, barometer.pressure(), barometer.temperature()); myled = 1; // LED is ON + Thread::wait(200); // 200 ms NB 'Thread::wait(int d);' !!! d is in milliseconds! + myled = 0; // LED is OFF t2.signal_set(READALL_OFF); } Thread::wait(200); - //Thread::wait(200); // 200 ms NB 'Thread::wait(int d);' !!! d is in milliseconds! - //myled = 0; // LED is OFF - //Thread::wait(100); // 100 ms + + } } void function2() @@ -86,6 +89,8 @@ string buffer_str(buffer); char date [32]; strftime(date, 32, "%Y/%m/%d %a", localtime(&seconds)); + char time [32]; + strftime(time, 32, "%H:%M:%S %p", localtime(&seconds)); if(buffer_str=="SETTIME") { set_time(1508268288); printf("time and date updated to %s %s\n\r", time, date); @@ -109,6 +114,8 @@ string buffer_str(buffer); char date [32]; strftime(date, 32, "%Y/%m/%d %a", localtime(&seconds)); + char time [32]; + strftime(time, 32, "%H:%M:%S %p", localtime(&seconds)); if(buffer_str=="SETT") { for (count = 0; count < 5; count++) { sz = snprintf(NULL, 0,"%s, %s, %4.2fC , %3.1f%%, %6.1f, %4.1f\n\r", time, date, tempCelsius, humi, barometer.pressure(), barometer.temperature()); @@ -138,7 +145,7 @@ if(buffer_str=="READ") { printf("%s\n\r", buf); myled = 1; - t5.signal_set(READ_OFF); + osSignalSet(idMain, ALL_OFF); } //Thread::wait(200); //myled = 0; @@ -159,8 +166,7 @@ id3 = t3.gettid(); id4 = t4.gettid(); time_t seconds = time(NULL); - char time [32]; - strftime(time, 32, "%H:%M:%S %p", localtime(&seconds)); + humidity.init(); humidity.calib(); printf("Type SETTIME to set time and date [enter] \n\r");