below is the error I am facing while running my code to get GSM module SIM800l network time. code is below the error message . Please help me out how the issue can be solved Thanks in advance.
"Arduino: 1.8.15 (Windows 10), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None"
sketch_jan18a:22:15: error: 'uint8_t time [6]' redeclared as different kind of symbol
uint8_t time[6]={0}; //An array for store time
^
In file included from C:\Users\khan ghalib\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6/tools/sdk/include/newlib/stdio.h:29:0,
from C:\Users\khan ghalib\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\cores\esp32/Arduino.h:27,
from sketch\sketch_jan18a.ino.cpp:1:
C:\Users\khan ghalib\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6/tools/sdk/include/newlib/time.h:53:11: note: previous declaration 'time_t time(time_t*)'
time_t _EXFUN(time, (time_t *_timer));
^
C:\Users\khan ghalib\Documents\Arduino\sketch_jan18a\sketch_jan18a.ino: In function 'void setup()':
sketch_jan18a:41:22: error: no matching function for call to 'SIM800L::GSMTime(time_t (&)(time_t*))'
if(gsm.GSMTime(time))
^
In file included from C:\Users\khan ghalib\Documents\Arduino\sketch_jan18a\sketch_jan18a.ino:16:0:
C:\Users\khan ghalib\Documents\Arduino\libraries\SIM800L-master/SIM800L.h:50:7: note: candidate: bool SIM800L::GSMTime(uint8_t*)
bool GSMTime(uint8_t *_time);
^
C:\Users\khan ghalib\Documents\Arduino\libraries\SIM800L-master/SIM800L.h:50:7: note: no known conversion for argument 1 from 'time_t(time_t*) {aka long int(long int*)}' to 'uint8_t* {aka unsigned char*}'
exit status 1
'uint8_t time [6]' redeclared as different kind of symbol
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
"
CODE:
#include <SIM800L.h>
#include <SoftwareSerial.h>
SoftwareSerial GSMserial(16, 17); // RX, TX
SIM800L gsm;
uint8_t time[6]={0}; //An array for store time
char printBuffer[50]={0};
void setup()
{
Serial.begin(9600);
GSMserial.begin(9600);
if(gsm.begin(GSMserial)) // Will return 1 if GSM responds and SIM card inserted then
{
Serial.println("GSM Initialized");
}
else
{
Serial.println("GSM not responding");
while(1); // Infinite loop, code will not execute other stuff
}
if(gsm.GSMTime(time))
{
Serial.println("Time read succesfully");
sprintf(printBuffer,"Time is :%d/%d/%d %d:%d:%d",time[2],time[1],time[0],time[3],time[4],time[5]);
}
else
{
Serial.println("SMS sending fail");
}
}
void loop()
{
}