LoRa Access Point 1.5.2018
Dependencies: mbed ds3231 SX1276Lib_LoRa_Access_Point
Diff: SD.cpp
- Revision:
- 11:376bfcdda0d4
- Parent:
- 10:e62222c46ee9
diff -r e62222c46ee9 -r 376bfcdda0d4 SD.cpp --- a/SD.cpp Thu Mar 28 09:55:48 2019 +0000 +++ b/SD.cpp Sat May 08 16:23:46 2021 +0000 @@ -93,8 +93,9 @@ // pc.printf("3. \r\n"); // fprintf(myLogFile,"HAMTALA"); // fprintf(myLogFile,"%.19s|", ctime(&epoch_time)); - fprintf(myLogFile,"%s", actual_time); - fprintf(myLogFile,"%s", data); +// fprintf(myLogFile,"%s", actual_time); +// fprintf(myLogFile,"%s", rtcClock.GetTime()); + fprintf(myLogFile,"%s\r\n", data); // pc.printf("4. \r\n"); // fprintf(myLogFile,"HAMTALA"); // if(myLogFile != NULL) @@ -107,3 +108,26 @@ // __enable_irq(); // Enable Interrupts } +void SD::Read() +{ + char myline [50]; + FILE *myLogFile = fopen("/sd/DATA_LOG.txt","r"); + if (myLogFile == NULL) + { + pc.printf("ERROR: failed to open the log file for writing!\r\n"); + } + else + { + pc.printf("READING FROM SD ::!\r\n"); + while (!feof(myLogFile)) + { + fscanf(myLogFile,"%[^\n]\n",myline); +// pc.printf("%s\r\n", myline); + wifi.SendMessage((char *)myline); + wait(0.01f); + } + + fclose(myLogFile); + + } +}; \ No newline at end of file