Hi I'm currently having an error with my programme and I'm not sure how to fix it properly so I thought I'd ask here to see. The project consists of a ESP8266, SIM 808 DRFBOT Arduino shield, LM35 and a LCD display
Arduino: 1.8.13 (Windows 10), Board: "Arduino Uno"
In file included from C:\Users\Owner\Documents\Arduino\libraries\WiFiEsp\src/WiFiEsp.h:30:0,
from C:\Users\Owner\Documents\Arduino\Dog_Tracker_Code\Dog_Tracker_Code.ino:14:
C:\Users\Owner\Documents\Arduino\libraries\WiFiEsp\src/utility/EspDrv.h:103:16: error: redeclaration of 'CLOSED'
CLOSED = 0,
^
In file included from C:\Users\Owner\Documents\Arduino\Dog_Tracker_Code\Dog_Tracker_Code.ino:5:0:
C:\Users\Owner\Documents\Arduino\libraries\DFRobot_SIM808-master/DFRobot_sim808.h:41:5: note: previous declaration 'Protocol CLOSED'
CLOSED = 0,
^~~~~~
C:\Users\Owner\Documents\Arduino\Dog_Tracker_Code\Dog_Tracker_Code.ino: In function 'void setup()':
C:\Users\Owner\Documents\Arduino\Dog_Tracker_Code\Dog_Tracker_Code.ino:56:41: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
sim808.sendSMS(PHONE_NUMBER, MESSAGE);
^
C:\Users\Owner\Documents\Arduino\Dog_Tracker_Code\Dog_Tracker_Code.ino:56:41: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
exit status 1
Error compiling for board Arduino Uno.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
My code:
#include <DFRobot_sim808.h>
// My Mobile number to send SMS
#define PHONE_NUMBER ""
// Message warning
#define MESSAGE ""
DFRobot_SIM808 sim808(&Serial);
#include<LiquidCrystal.h> //Header file for LCD Module
#include "WiFiEsp.h" // Library for ESP8266
#ifndef HAVE_HWSERIAL1
#include "SoftwareSerial.h"
SoftwareSerial Serial1(6, 7); // RX, TX
#endif
char ssid[] = ""; // Network Name
char pass[] = "Network password goes here"; // Network Password
int status = WL_IDLE_STATUS; // Wifi radio's status
int reqCount = 0; // number of requests received
WiFiEspServer server(80);
LiquidCrystal lcd(12, 10, 5, 4, 3, 2); //lcd connected pins
const int sensor = A0; //Assigning analog A0 to LM35
float tempc; //Storing temp in °C
float tempf; //Storing temp in °F
float vout; //variable to store values from sensor
void setup()
{
// initialize serial for debugging
Serial.begin(115200);
// initialize serial for ESP module
Serial1.begin(9600);
// initialize ESP module
WiFi.init(&Serial1);
lcd.begin(16, 2);
lcd.print("DOG TRACKER\nDEVICE");
pinMode(A0, INPUT);
{
while (!sim808.init()) {
delay(1000);
Serial.print("Sim808 init error\r\n");
}
Serial.println("Sim808 init success");
Serial.println("Start to send message ...");
// phone number and SMS
sim808.sendSMS(PHONE_NUMBER, MESSAGE);
}
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to WPA SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network
status = WiFi.begin(ssid, pass);
}
Serial.println("You're connected to the network");
// start the web server on port 80
server.begin();
printWifiStatus();
}
void loop(){
vout=analogRead(sensor);
vout=(vout*500)/1023;
tempc=vout; // Storing value in °C
tempf=(vout*1.8)+32; //conversion of °C to °F
lcd.setCursor(0,0);
Serial.println(tempc);
if(tempc>=35) // Using a max of 35°C as an alert temperature for the LM35
{
lcd.print("HIGH TEMP!! ");
lcd.setCursor(0,1);
lcd.print("C=");
lcd.print(tempc);
lcd.print(" F=");
lcd.print(tempf);
}
else
{
lcd.print("Temp is within range");
lcd.setCursor(0,1);
lcd.print("C=");
lcd.print(tempc);
lcd.print(" F=");
lcd.print(tempf);
digitalWrite(9,0);
}
delay(1000);
}
void printWifiStatus()
{
// print the SSID of the network you're attached to
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
// print your WiFi shield's IP address
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
// print where to go in the browser
Serial.println();
Serial.print("To see this page in action, open a browser to http://");
Serial.println(ip);
Serial.println();
}