Multiple libraries were found for "ESP8266HTTPClient.h"
Used: C:\Users\UTILISATEUR\Documents\Arduino\libraries\ESP8266HTTPClient
Not used: C:\Users\UTILISATEUR\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266HTTPClient
exit status 1
this is the code
/////////////////////////////////
// Generated with a lot of love//
// with TUNIOT FOR ESP8266 //
// Website: Easycoding.tn //
/////////////////////////////////
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
String ClientRequest;
IPAddress staticIP317_10(192,168,1,10);
IPAddress gateway317_10(192,168,1,1);
IPAddress subnet317_10(255,255,255,0);
WiFiServer server(80);
IPAddress staticIP(10,10,10,10);
IPAddress gateway(10,10,10,1);
IPAddress subnet(255,0,0,0);
String httpurl;
HTTPClient http;
void emergency() {
if (digitalRead(0) == 0) {
tone(14, 700 , 300);
delay(600);
}
}
void setup()
{
ClientRequest = "";
Serial.begin(9600);
WiFi.disconnect();
delay(3000);
Serial.println("START");
WiFi.begin("Home WiFi","Sophobox64@");
while ((!(WiFi.status() == WL_CONNECTED))){
delay(300);
Serial.println("connexion au réseau ... ");
}
Serial.println("Connected");
WiFi.config(staticIP317_10, gateway317_10, subnet317_10);
Serial.println("Your IP is");
Serial.println((WiFi.localIP().toString()));
server.begin();
WiFi.softAP("Friensd Bot V1 ESP","123456789");
WiFi.softAPConfig(staticIP, gateway, subnet);
tone(14, 700 , 300);
delay(1000);
pinMode(0, INPUT);
}
void loop()
{
if (false) {
}
emergency();
WiFiClient client = server.available();
if (!client) { return; }
while(!client.available()){ delay(1); }
ClientRequest = (client.readStringUntil('\r'));
ClientRequest.remove(0, 5);
ClientRequest.remove(ClientRequest.length()-9,9);
Serial.println("code reçu :");
Serial.println(ClientRequest);
emergency();
client.flush();
httpurl = "http://";
httpurl+="192.168.1.20";
httpurl+="/";
httpurl+="emergency";
http.begin(httpurl);
http.GET();
http.end();
}
can you help me please
What do you need help with ?
The compiler found multiple libraries with the same name and resolved the conflict
et maintenant j'ai cette erreur
c:\Users\UTILISATEUR\Documents\Arduino\libraries\ESP8266HTTPClient\src\ESP8266HTTPClient.cpp:29:23: fatal error: StreamDev.h: No such file or directory
#include <StreamDev.h>
^
compilation terminated.
exit status 1
Compilation error: exit status 1
Do you have this library installed and, if so, where is it located on your PC ?
no i can't find this library
ESP8266HTTPClient.cpp
#include "ESP8266HTTPClient.h"
#include <ESP8266WiFi.h>
#include <StreamDev.h>
#include <base64.h>
/**
* ESP8266HTTPClient.cpp
*
* Created on: 02.11.2015
*
* Copyright (c) 2015 Markus Sattler. All rights reserved.
* This file is part of the ESP8266HTTPClient for Arduino.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include <Arduino.h>
#include <coredecls.h>
#include "ESP8266HTTPClient.h"
#include <ESP8266WiFi.h>
#include <StreamDev.h>
#include <base64.h>
// per https://github.com/esp8266/Arduino/issues/8231
// make sure HTTPClient can be utilized as a movable class member
static_assert(std::is_default_constructible_v<HTTPClient>, "");
static_assert(!std::is_copy_constructible_v<HTTPClient>, "");
static_assert(std::is_move_constructible_v<HTTPClient>, "");
static_assert(std::is_move_assignable_v<HTTPClient>, "");
static const char defaultUserAgentPstr[] PROGMEM = "ESP8266HTTPClient";
const String HTTPClient::defaultUserAgent = defaultUserAgentPstr;
int HTTPClient::StreamReportToHttpClientReport (Stream::Report streamSendError)
{
switch (streamSendError)
{
case Stream::Report::TimedOut: return HTTPC_ERROR_READ_TIMEOUT;
case Stream::Report::ReadError: return HTTPC_ERROR_NO_STREAM;
case Stream::Report::WriteError: return HTTPC_ERROR_STREAM_WRITE;
case Stream::Report::ShortOperation: return HTTPC_ERROR_STREAM_WRITE;
case Stream::Report::Success: return 0;
}
return 0; // never reached, keep gcc quiet
}
void HTTPClient::clear()
{
_returnCode = 0;
_size = -1;
_headers.clear();
_location.clear();
_payload.reset();
}
see more here
Which board do you have selected in the IDE ?
Which version of the ESP8266 board files do you have installed ?
StreamDev.h is on my PC in the following folder
C:\Users\Bob2\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\cores\esp8266\StreamDev.h
Substitute your Windows Username for mine (Bob2) and look in that folder
it's v3.1.2
i found this "C:\Users\UTILISATEUR\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\cores\esp8266\StreamDev.h" and this error now
C:\Users\UTILISATEUR\Documents\Arduino\sketch_jul19a\sketch_jul19a.ino: In function 'void loop()':
C:\Users\UTILISATEUR\Documents\Arduino\sketch_jul19a\sketch_jul19a.ino:82:15: error: call to 'HTTPClient::begin' declared with attribute error: obsolete API, use ::begin(WiFiClient, url)
82 | http.begin(httpurl);
| ~~~~~~~~~~^~~~~~~~~
Multiple libraries were found for "ESP8266HTTPClient.h"
Used: C:\Users\UTILISATEUR\Documents\Arduino\libraries\ESP8266HTTPClient
Not used: C:\Users\UTILISATEUR\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266HTTPClient
exit status 1
Compilation error: call to 'HTTPClient::begin' declared with attribute error: obsolete API, use ::begin(WiFiClient, url)
As I understand it, the error message says that your sketch is using a call to the http.begin() function that is no longer supported, ie
http.begin(httpurl);
and that it should be replaced by
http.begin(client, httpurl);
This is not an area that I have much knowledge about, but it is worth a try
Are you saying that your code compiles now ?
How did you solve the problem with StreamDev.h not being found ?
in the end it doesn't work either
C:\Users\UTILISATEUR\Documents\Arduino\sketch_jul19a\sketch_jul19a.ino: In function 'void loop()':
C:\Users\UTILISATEUR\Documents\Arduino\sketch_jul19a\sketch_jul19a.ino:48:18: error: 'client' was not declared in this scope; did you mean 'Client'?
48 | http.begin(client, httpurl);
| ^~~~~~
| Client
Multiple libraries were found for "ESP8266HTTPClient.h"
Used: C:\Users\UTILISATEUR\Documents\Arduino\libraries\ESP8266HTTPClient
Not used: C:\Users\UTILISATEUR\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266HTTPClient
exit status 1
Compilation error: 'client' was not declared in this scope; did you mean 'Client'?
Please post the full sketch that produces that error
I believe that you have made other changes to your original code. Did you rename client to Client in this line ?
WiFiClient client = server.available();
By the way, the sketch compiles for me
/////////////////////////////////
// Generated with a lot of love//
// with TUNIOT FOR ESP8266 //
// Website: Easycoding.tn //
/////////////////////////////////
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
IPAddress staticIP534_10(192,168,1,10);
IPAddress gateway534_10(192,168,1,1);
IPAddress subnet534_10(255,255,255,0);
String httpurl;
HTTPClient http;
void setup()
{
Serial.begin(9600);
pinMode(0, INPUT);
pinMode(14, OUTPUT);
WiFi.disconnect();
delay(3000);
Serial.println("START");
WiFi.begin("Home WiFi","Sophobox64@");
while ((!(WiFi.status() == WL_CONNECTED))){
delay(300);
Serial.print("..");
}
Serial.println("Connected");
WiFi.config(staticIP534_10, gateway534_10, subnet534_10);
Serial.println("Your IP is");
Serial.println((WiFi.localIP().toString()));
}
void loop()
{
if (digitalRead(0) == 0) {
digitalWrite(14,HIGH);
httpurl = "http://";
httpurl+="192,168,1,20";
httpurl+="/";
httpurl+="emergency";
http.begin(client, httpurl);
http.GET();
http.end();
} else {
digitalWrite(14,LOW);
}
}
That is very different from the code that you originally posted. For instance, nowhere in the latest one do you declare a WiFiClient as you do in the original one so this line
http.begin(client, httpurl);
can never work