New Errors since updating

Hello,
Something in the new updates caused a problem with previously working code.
I tried the suggestions I could find through searching to no avail.

Here's the program code......

//This File Works Perfectly on Dec 31, 2017 (With DHT11) (Not DHT22)

#include"dht.h"                      // Including library for dht
#include<LiquidCrystal.h>
LiquidCrystal lcd(14,15,16,17,18,19);
#include<Timer.h>
Timer t;
#include <SoftwareSerial.h>
SoftwareSerial Serial1(2, 3);

#define dht_dpin 12 
#define heart 13
dht DHT;

const char *workaround = "OK";
const char *api_key="xyz";     // Enter your Write API key from ThingSpeak
static char postUrl[150];
float humi;
float tem;
//int tem,humi;
float temConv;
float humiConv;
void httpGet(String ip, String path, int port=80);

void setup()
{
 lcd.begin(16, 2);
 lcd.clear();
 lcd.print("   Humidity   ");
 lcd.setCursor(0,1);
 lcd.print("  Measurement ");
 delay(2000);
 lcd.clear();
 lcd.print("Circuit Digest ");
 lcd.setCursor(0,1);
 lcd.print("Welcomes You");
 delay(2000);
 Serial1.begin(115200);
 Serial.begin(115200);
 lcd.clear();
 lcd.print("WIFI Connecting");
 lcd.setCursor(0,1);
 lcd.print("Please wait....");
 Serial.println("Connecting Wifi....");
 connect_wifi("AT",1000);
 connect_wifi("AT+CWMODE=1",1000);
 connect_wifi("AT+CIPSTA=\"192.168.003.56\",\"192.168.003.001\",\"255.255.255.000\"",10000);
  connect_wifi("AT+CWQAP",1000);  
 connect_wifi("AT+RST",5000);
  connect_wifi("AT+CWJAP=\"tcharlie\",\"missusa\"",10000);
 Serial.println("Wifi Connected"); 
 lcd.clear();
 lcd.print("WIFI Connected.");
 pinMode(heart, OUTPUT);
 delay(2000);
 t.oscillate(heart, 1000, LOW);
 t.every(20000, send2server);
}

void loop()
{

  DHT.read11(dht_dpin);
  lcd.setCursor(0,0);
  lcd.print("Humidity: ");
  humi=DHT.humidity;
  lcd.print(humi);   // printing Humidity on LCD
  lcd.print(" %    ");
  lcd.setCursor(0,1);
  lcd.print("Temperature:");
  tem=DHT.temperature;
  lcd.print(tem);   // Printing temperature on LCD
  lcd.write(1);
  lcd.print("C   ");
  delay(2000);
  t.update();
}

void send2server()
{
  char tempStr[8];
  char humidStr[8];
  temConv=(tem*1.8)+32;
  //temConv=tem;
  // temConv=temConv-1.4; //Correction for DHT11-1
  humiConv=humi-9; // Correction for DHT11-1
  
  dtostrf(temConv, 5, 3, tempStr);
  dtostrf(humiConv, 5, 3, humidStr);
  sprintf(postUrl, "update?api_key=%s&field1=%s&field2=%s",api_key,humidStr,tempStr);
  httpGet("api.thingspeak.com", postUrl, 80);
}

//GET https://api.thingspeak.com/update?api_key=SIWOYBX26OXQ1WMS&field1=0

void httpGet(String ip, String path, int port)
{
  int resp;
  String atHttpGetCmd = "GET /"+path+" HTTP/1.0\r\n\r\n";
  //AT+CIPSTART="TCP","192.168.20.200",80
  String atTcpPortConnectCmd = "AT+CIPSTART=\"TCP\",\""+ip+"\","+port+"";
  connect_wifi(atTcpPortConnectCmd,1000);
  int len = atHttpGetCmd.length();
  String atSendCmd = "AT+CIPSEND=";
  atSendCmd+=len;
  connect_wifi(atSendCmd,1000);
  connect_wifi(atHttpGetCmd,1000);
}

void connect_wifi(String cmd, int t)
{
  int temp=0,i=0;
  while(1)
  {
    lcd.clear();
    lcd.print(cmd);
    Serial.println(cmd);
    Serial1.println(cmd); 
    while(Serial1.available())
    {
      if(Serial1.find("workaround"))

      i=8;
    }
    delay(t);
    if(i>5)
    break;
    i++;
  }
  if(i==8)
  {
   Serial.println("OK");
        lcd.setCursor(0,1);
      lcd.print("OK");
  }
  else
  {
   Serial.println("Error");
         lcd.setCursor(0,1);
      lcd.print("Error");
  }
}

And here are the errors.....

C:\Users\Gumby\Documents\Arduino\HumidityTemp_ThingSpeak_3_WORKING\HumidityTemp_ThingSpeak_3_WORKING.ino: In function 'void connect_wifi(String, int)':

C:\Users\Gumby\Documents\Arduino\HumidityTemp_ThingSpeak_3_WORKING\HumidityTemp_ThingSpeak_3_WORKING.ino:121:35: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

       if(Serial1.find("workaround"))

                                   ^

There is no error in that message, only a warning (that can be ignored).

To get rid of the warning, you can use a cast to a char pointer

if(Serial1.find((char*)"workaround"))

Sure enough....that worked.

Not sure what else to do. I look at the examples and try to follow them, but they don't work.
Then someone (in this case you), offers a syntax different from the other and it works.
Frustrating to say the least.

Thanks!

Compilers evolve. This was just a warning and this one could be ignored; it states that what you do in future might result in an error (and your code will not compile).

There are warnings that you should not ignore, e.g. not returning a value from a function that is supposed to return a value.

The only thing that you can do is to understand the message and in this case understand what kind of parameters a function expects and what you're actually passing. And that requires a bit of experience with C/C++.

While the code compiles without errors and seems to work ok, I am getting an error (instead of OK) in the output of the esp8266 dialog as shown below...

I'm now wondering if the declaration is the problem?

const char *workaround="OK";

Connecting Wifi....
AT
AT
AT
AT
AT
AT
AT
Error
AT+CWMODE=1
AT+CWMODE=1
AT+CWMODE=1
AT+CWMODE=1
AT+CWMODE=1
AT+CWMODE=1
AT+CWMODE=1
Error
AT+CIPSTA="192.168.003.56","192.168.003.001","255.255.255.000"
AT+CIPSTA="192.168.003.56","192.168.003.001","255.255.255.000"
AT+CIPSTA="192.168.003.56","192.168.003.001","255.255.255.000"
AT+CIPSTA="192.168.003.56","192.168.003.001","255.255.255.000"
AT+CIPSTA="192.168.003.56","192.168.003.001","255.255.255.000"
AT+CIPSTA="192.168.003.56","192.168.003.001","255.255.255.000"
AT+CIPSTA="192.168.003.56","192.168.003.001","255.255.255.000"
Error
AT+CWQAP
AT+CWQAP
AT+CWQAP
AT+CWQAP
AT+CWQAP
AT+CWQAP
AT+CWQAP
Error
AT+RST
AT+RST
AT+RST
AT+RST
AT+RST
AT+RST
AT+RST
Error
AT+CWJAP="Checkpoint","mypassword"
AT+CWJAP="Checkpoint","mypassword"
AT+CWJAP="Checkpoint","mypassword"
AT+CWJAP="Checkpoint","mypassword"
AT+CWJAP="Checkpoint","mypassword"
AT+CWJAP="Checkpoint","mypassword"
AT+CWJAP="Checkpoint","mypassword"
Error
Wifi Connected
AT+CIPSTART="TCP","http://dataserver.com/arduino/temphumidity.cfm",80
AT+CIPSTART="TCP","http://dataserver.com/arduino/temphumidity.cfm",80
AT+CIPSTART="TCP","http://dataserver.com/arduino/temphumidity.cfm",80
AT+CIPSTART="TCP","http://dataserver.com/arduino/temphumidity.cfm",80
AT+CIPSTART="TCP","http://dataserver.com/arduino/temphumidity.cfm",80
AT+CIPSTART="TCP","http://dataserver.com/arduino/temphumidity.cfm",80
AT+CIPSTART="TCP","http://dataserver.com/arduino/temphumidity.cfm",80
Error
AT+CIPSEND=77
AT+CIPSEND=77
AT+CIPSEND=77
AT+CIPSEND=77
AT+CIPSEND=77
AT+CIPSEND=77
AT+CIPSEND=77
Error
GET /update?api_key=ABCXYZ1234567&field1=39.000&field2=80.600 HTTP/1.0
GET /update?api_key=ABCXYZ1234567&field1=39.000&field2=80.600 HTTP/1.0
GET /update?api_key=ABCXYZ1234567&field1=39.000&field2=80.600 HTTP/1.0
GET /update?api_key=ABCXYZ1234567&field1=39.000&field2=80.600 HTTP/1.0
GET /update?api_key=ABCXYZ1234567&field1=39.000&field2=80.600 HTTP/1.0
GET /update?api_key=ABCXYZ1234567&field1=39.000&field2=80.600 HTTP/1.0
GET /update?api_key=ABCXYZ1234567&field1=39.000&field2=80.600 HTTP/1.0
if(Serial1.find("workaround"))

This is looking for the string "workaround" not the string "OK". Does the response coming back contain the string "workaround"?

If you want it to look for the string "OK" then take the quotes off "workaround" so it is a variable identifier and not a string.

That did it !

Thanks DeltaG :slight_smile: