![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
needs more commenting, log file errors, LED feedback
Dependencies: ARCH_GPRS_V2_HW Blinker GPRSInterface HTTPClient_GPRS RTC_WorkingLibrary SDFileSystem USBDevice mbed
Fork of finalv2 by
Revision 5:96d91bbd6c14, committed 2015-05-08
- Comitter:
- mbotkinl
- Date:
- Fri May 08 14:57:00 2015 +0000
- Parent:
- 4:f7f454e6c865
- Commit message:
- Final working version
Changed in this revision
finalCodev3.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r f7f454e6c865 -r 96d91bbd6c14 finalCodev3.cpp --- a/finalCodev3.cpp Wed May 06 13:12:17 2015 +0000 +++ b/finalCodev3.cpp Fri May 08 14:57:00 2015 +0000 @@ -1,5 +1,5 @@ //SEED Team 20 Final Code draft 1 4/16/15 - + #include "mbed.h" #include "SDFileSystem.h" #include "ARCH_GPRS_V2_HW.h" @@ -104,7 +104,7 @@ *lightData = lightSensor*1000; } -//void errorWrite(const char* errorReport) { +//method to write error reports to ErrorLog.txt file on SD card void errorWrite(string errorReport) { rtc.gettime( &sec, &minute, &hours, &day, &date, &month, &year); //get time from RTC sprintf(timestamp,"20%.2d-%.2d-%.2d %.2d:%.2d:%.2d", year, month, date, hours, minute, sec); // create timmestamp @@ -120,6 +120,8 @@ blueLED.blink(5); } } + +//method to read config.txt file on SD card bool ReadFile (void) { mkdir("/sd", 0777); // All other times open file in append mode FILE *fp = fopen("/sd/config.txt","r"); @@ -131,21 +133,15 @@ return false; } else if (fp) { - //fscanf(fp,"%16c %d %s %s", APIKey, &numSensors, sensors[0],sensors[1]); - fscanf(fp,"%16c",APIKey); - -// pc.printf("APIKEY= %s\r\n",APIKey); -// + + fscanf(fp,"%16c",APIKey); fscanf(fp,"%d",&numSensors); -// pc.printf("number of sensors = %d \r\n",numSensors); -// + for (int i = 0; i<numSensors;i=i+1) { - //fscanf(fp,"%s",sensors[i]); fscanf(fp,"%s",sensorBuff); strcpy(sensors[i],sensorBuff); } - fclose(fp); return true; @@ -305,30 +301,6 @@ int main() { wdt_sleep.wdtClkSetup(WDTCLK_SRC_IRC_OSC); //set up sleep wait(2); - //test of breadboard -// while (1) { -// //rtc test -// errorR="Test rtc"; -// rtc.gettime( &sec, &minute, &hours, &day, &date, &month, &year); -// sprintf(timestamp,"20%.2d-%.2d-%.2d %.2d:%.2d:%.2d", year, month, date, hours, minute, sec); -// pc.printf("%s: %s\r\n",timestamp,errorR); -// wait(1); -// // //rgb test -// pc.printf("green blink\r\n"); -// greenLED.blink(5); -// -// pc.printf("red blink\r\n"); -// redLED.blink(5); -// -// pc.printf("blue blink\r\n"); -// blueLED.blink(5); -// -// //light sensor test -// getLightReading(&lightData); -// pc.printf("light reading: %d \r\n",lightData); -// -// wait(5); -// } //read SD card