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 0NicksCoursework_copywithserialtime by
Revision 9:e27b3f34de24, committed 2018-01-09
- Comitter:
- liam_grazier
- Date:
- Tue Jan 09 06:14:41 2018 +0000
- Parent:
- 8:582ac4c5a524
- Child:
- 10:c9c1522957b2
- Commit message:
- NICKS CW;
Changed in this revision
| Components/components.cpp | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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");
--- a/main.cpp Tue Jan 09 05:43:43 2018 +0000
+++ b/main.cpp Tue Jan 09 06:14:41 2018 +0000
@@ -4,7 +4,7 @@
#include "lglcd.h"
#include "stx.hpp"
Thread samplesThread(osPriorityNormal);
-Thread sdThread(osPriorityLow);
+Thread sdThread(osPriorityHigh);
Thread sdRemoveThread(osPriorityHigh);
Thread timebuttonThread(osPriorityNormal);
Thread stxThread(osPriorityLow);
@@ -50,6 +50,7 @@
int main(){
lglcd mylcd(D7,D6,D5,D4,D3,D2);
setuptime();
+printf("NEWIT");
sdrun();
lcdstart();
welcomemsg();
