error messages

Im getting these error messages

Arduino: 1.8.9 (Windows 8.1), Board: “Generic ESP8266 Module, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), dtr (aka nodemcu), 26 MHz, 40MHz, DOUT (compatible), 1MB (FS:64KB OTA:~470KB), 2, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory, Disabled, None, Only Sketch, 115200”

C:\Users\RENA M\AppData\Local\Microsoft\Windows\INetCache\IE\9XKHNQVY\ultra_25_jul_cppy2__test3_checking_lc_and_ultra_working_eric3\ultra_25_jul_cppy2__test3_checking_lc_and_ultra_working_eric3.ino: In function ‘void setup()’:

ultra_25_jul_cppy2__test3_checking_lc_and_ultra_working_eric3:78:27: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]

WiFi.begin(ssid, password);

^

In file included from C:\Users\RENA M\AppData\Local\Microsoft\Windows\INetCache\IE\9XKHNQVY\ultra_25_jul_cppy2__test3_checking_lc_and_ultra_working_eric3\ultra_25_jul_cppy2__test3_checking_lc_and_ultra_working_eric3.ino:1:0:

C:\Program Files (x86)\Arduino\libraries\WiFi\src/WiFi.h:79:9: error: initializing argument 1 of ‘int WiFiClass::begin(char*, const char*)’ [-fpermissive]

int begin(char* ssid, const char *passphrase);

^

C:\Users\RENA M\AppData\Local\Microsoft\Windows\INetCache\IE\9XKHNQVY\ultra_25_jul_cppy2__test3_checking_lc_and_ultra_working_eric3\ultra_25_jul_cppy2__test3_checking_lc_and_ultra_working_eric3.ino: At global scope:

ultra_25_jul_cppy2__test3_checking_lc_and_ultra_working_eric3:82:1: error: ‘ThingSpeak’ does not name a type

ThingSpeak.begin(client);

^

ultra_25_jul_cppy2__test3_checking_lc_and_ultra_working_eric3:84:1: error: expected declaration before ‘}’ token

}

^

exit status 1
invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

This is my code

#include <WiFi.h>
#include <WiFiClient.h>
#include <WiFiServer.h>
#include <WiFiUdp.h>

#include <ESP8266WiFi.h>;

#include <WiFiClient.h>;

#include <ThingSpeak.h>;

#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

//Define variables for the LCD

#define I2C_ADDR 0x27 //Define I2C Address where the PCF8574A is
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7

#define TRIGGER 0
#define ECHO 2
// NodeMCU Pin d3 > TRIGGER | Pin d4 > ECHO

const char* ssid = “Eric”; //Your Network SSID

const char* password = “1234554321”; //Your Network Password

int val;

//int LDRpin = A0; //LDR Pin Connected at A0 Pin

WiFiClient client;

unsigned long myChannelNumber = 842412; //Your Channel Number (Without Brackets)

const char * myWriteAPIKey = “SPEC45UHZ1QY37D9”; //Your Write API Key

void setup()

{

lcd.begin(16,2);

Serial.begin(115200);

pinMode(TRIGGER, OUTPUT);
pinMode(ECHO, INPUT);
//pinMode(BUILTIN_LED, OUTPUT);

delay(10);

// Connect to WiFi network

WiFi.begin(ssid, password); //my error messages are for this line
}

ThingSpeak.begin(client);

}

void loop()

{

long duration, distance;
digitalWrite(TRIGGER, LOW);
delayMicroseconds(2);

digitalWrite(TRIGGER, HIGH);
delayMicroseconds(10);

digitalWrite(TRIGGER, LOW);
duration = pulseIn(ECHO, HIGH);
distance= duration*0.034/2;
long level = 34 - distance;
Serial.print(distance);
Serial.println(“Centimeter:”);

Serial.print(level);
Serial.println(“Centimeter:”);
delay(1000);

//val = analogRead(LDRpin); //Read Analog values and Store in val variable

//Serial.print(distance); //Print on Serial Monitor

lcd.setCursor(0,0); // Sets the location at which subsequent text written to the LCD will be displayed
lcd.print(“Dam Lev: “); // Prints string “Distance” on the LCD
lcd.print(level); // Prints the distance value from the sensor
lcd.print(” cm “);
delay(10);
lcd.setCursor(0,1);
lcd.print(“Danger Lev:”);
lcd.print(“15”);
lcd.print(” cm”);
delay(10);

delay(1000);

ThingSpeak.writeField(myChannelNumber, 1,level, myWriteAPIKey); //Update in ThingSpeak

delay(100);

}

I don’t know what this error means. Can anyone help?

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom... :slight_smile:

You're using the wrong library. You need to use the ESP8266WiFi library with your ESP8266, not the WiFi library. For some incomprehensible reason, you're attempting to use both in your sketch. The WiFi library is for the retired Arduino WiFi Shield, and I'm 100% certain you're not using one of those on your ESP8266.

You can find the ESP8266WiFi library's examples under File > Examples > ESP8266WiFi.

More information here:
https://arduino-esp8266.readthedocs.io/en/2.6.3/esp8266wifi/readme.html

I deleted it the <wifi.h> library
but im getting this error
(Thingspeak does not name a type)

Arduino: 1.8.9 (Windows 8.1), Board: “Generic ESP8266 Module, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), dtr (aka nodemcu), 26 MHz, 40MHz, DOUT (compatible), 1MB (FS:64KB OTA:~470KB), 2, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory, Disabled, None, Only Sketch, 115200”

In file included from C:\Users\RENA M\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266WiFi\src/WiFiClientSecure.h:41:0,

from C:\Users\RENA M\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266WiFi\src/WiFiServerSecure.h:20,

from C:\Users\RENA M\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266WiFi\src/ESP8266WiFi.h:41,

from C:\Users\RENA M\AppData\Local\Microsoft\Windows\INetCache\IE\9XKHNQVY\ultra_25_jul_cppy2__test3_checking_lc_and_ultra_working_eric3\ultra_25_jul_cppy2__test3_checking_lc_and_ultra_working_eric3.ino:6:

C:\Users\RENA M\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266WiFi\src/WiFiClientSecureBearSSL.h:262:36: error: expected ‘)’ before ‘*’ token

WiFiClientSecure(ClientContext *client, const X509List *chain, unsigned cert_issuer_key_type,

^

C:\Users\RENA M\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266WiFi\src/WiFiClientSecureBearSSL.h:264:35: error: expected ‘)’ before ‘*’ token

WiFiClientSecure(ClientContext* client, const X509List *chain, const PrivateKey *sk,

^

C:\Users\RENA M\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266WiFi\src/WiFiClientSecureBearSSL.h:38:5: error: ‘BearSSL::WiFiClientSecure::~WiFiClientSecure()’ marked override, but does not override

~WiFiClientSecure() override;

^

C:\Users\RENA M\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266WiFi\src/WiFiClientSecureBearSSL.h:43:9: error: ‘int BearSSL::WiFiClientSecure::connect(const String&, uint16_t)’ marked override, but does not override

int connect(const String& host, uint16_t port) override;

^

C:\Users\RENA M\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266WiFi\src/WiFiClientSecureBearSSL.h:48:12: error: ‘size_t BearSSL::WiFiClientSecure::write_P(const char*, size_t)’ marked override, but does not override

size_t write_P(PGM_P buf, size_t size) override;

^

C:\Users\RENA M\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266WiFi\src/WiFiClientSecureBearSSL.h:60:12: error: ‘size_t BearSSL::WiFiClientSecure::peekBytes(uint8_t*, size_t)’ marked override, but does not override

size_t peekBytes(uint8_t *buffer, size_t length) override;

^

ultra_25_jul_cppy2__test3_checking_lc_and_ultra_working_eric3:82:1: error: ‘ThingSpeak’ does not name a type

ThingSpeak.begin(client);

^

ultra_25_jul_cppy2__test3_checking_lc_and_ultra_working_eric3:84:1: error: expected declaration before ‘}’ token

}

^

Multiple libraries were found for “WiFiClient.h”
Used: C:\Program Files (x86)\Arduino\libraries\WiFi
Not used: C:\Users\RENA M\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266WiFi
exit status 1
‘ThingSpeak’ does not name a type

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

Please also use code tags, as explained at the link TomGeorge provided, when you post error output.

programmer8055:
I deleted it the <wifi.h> library

But you’re still using the WiFi library:

programmer8055:
Multiple libraries were found for “WiFiClient.h”
Used: C:\Program Files (x86)\Arduino\libraries\WiFi

Delete all the lines of your sketch that come before this one:

#include <ESP8266WiFi.h>;

I deleted the libraries above <esp8266wifi.h> and also the <wificlient.h>
but it shows that thingsspeak does not have a name .

Arduino: 1.8.9 (Windows 8.1), Board: "Generic ESP8266 Module, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), dtr (aka nodemcu), 26 MHz, 40MHz, DOUT (compatible), 1MB (FS:64KB OTA:~470KB), 2, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

ultra_25_jul_cppy2__test3_checking_lc_and_ultra_working_eric3:80:1: error: 'ThingSpeak' does not name a type

 ThingSpeak.begin(client);

 ^

ultra_25_jul_cppy2__test3_checking_lc_and_ultra_working_eric3:82:1: error: expected declaration before '}' token

 }

 ^

exit status 1
'ThingSpeak' does not name a type

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

That's a new problem, and you created a new topic to discuss it:

Let's confine the discussion of the ThingSpeak error to the other thread.