In file included from C:\Users\mrang\Downloads\New folder\Test_Blynk\BlynkEdgent.h:9,
from C:\Users\mrang\Downloads\New folder\Test_Blynk\Test_Blynk.ino:11:
c:\Users\mrang\OneDrive\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp8266_SSL.h:105:7: error: ‘BlynkWifi’ is not a template
105 | class BlynkWifi
| ^~~~~~~~~
In file included from C:\Users\mrang\Downloads\New folder\Test_Blynk\Test_Blynk.ino:6:
c:\Users\mrang\OneDrive\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp8266.h:29:7: note: previous declaration here
29 | class BlynkWifi
| ^~~~~~~~~
In file included from C:\Users\mrang\Downloads\New folder\Test_Blynk\BlynkEdgent.h:9,
from C:\Users\mrang\Downloads\New folder\Test_Blynk\Test_Blynk.ino:11:
c:\Users\mrang\OneDrive\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp8266_SSL.h:192:27: error: conflicting declaration ‘BearSSL::WiFiClientSecure _blynkWifiClient’
192 | static WiFiClientSecure _blynkWifiClient;
| ^~~~~~~~~~~~~~~~
In file included from C:\Users\mrang\Downloads\New folder\Test_Blynk\Test_Blynk.ino:6:
c:\Users\mrang\OneDrive\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp8266.h:100:21: note: previous declaration as ‘WiFiClient _blynkWifiClient’
100 | static WiFiClient _blynkWifiClient;
| ^~~~~~~~~~~~~~~~
In file included from C:\Users\mrang\Downloads\New folder\Test_Blynk\BlynkEdgent.h:9,
from C:\Users\mrang\Downloads\New folder\Test_Blynk\Test_Blynk.ino:11:
c:\Users\mrang\OneDrive\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp8266_SSL.h:193:53: error: conflicting declaration ‘BlynkArduinoClientSecureBearSSL::WiFiClientSecure _blynkTransport’
193 | static BlynkArduinoClientSecure _blynkTransport(_blynkWifiClient);
| ^~~~~~~~~~~~~~~
In file included from C:\Users\mrang\Downloads\New folder\Test_Blynk\Test_Blynk.ino:6:
c:\Users\mrang\OneDrive\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp8266.h:101:29: note: previous declaration as ‘BlynkArduinoClient _blynkTransport’
101 | static BlynkArduinoClient _blynkTransport(_blynkWifiClient);
| ^~~~~~~~~~~~~~~
In file included from C:\Users\mrang\Downloads\New folder\Test_Blynk\BlynkEdgent.h:9,
from C:\Users\mrang\Downloads\New folder\Test_Blynk\Test_Blynk.ino:11:
c:\Users\mrang\OneDrive\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp8266_SSL.h:194:3: error: ‘BlynkWifi’ is not a template
194 | BlynkWifi<BlynkArduinoClientSecure > Blynk(_blynkTransport);
| ^~~~~~~~~
c:\Users\mrang\OneDrive\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp8266_SSL.h:194:58: error: redefinition of ‘BlynkWifi Blynk’
194 | BlynkWifi<BlynkArduinoClientSecure > Blynk(_blynkTransport);
| ^~~~~
In file included from C:\Users\mrang\Downloads\New folder\Test_Blynk\Test_Blynk.ino:6:
c:\Users\mrang\OneDrive\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp8266.h:102:13: note: ‘BlynkWifi Blynk’ previously declared here
102 | BlynkWifi Blynk(_blynkTransport);
| ^~~~~
In file included from c:\Users\mrang\OneDrive\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp8266_SSL.h:199,
from C:\Users\mrang\Downloads\New folder\Test_Blynk\BlynkEdgent.h:9,
from C:\Users\mrang\Downloads\New folder\Test_Blynk\Test_Blynk.ino:11:
c:\Users\mrang\OneDrive\Documents\Arduino\libraries\Blynk\src/BlynkWidgets.h:20:7: error: redefinition of ‘class VPinWriteOnChange’
20 | class VPinWriteOnChange {
| ^~~~~~~~~~~~~~~~~
In file included from c:\Users\mrang\OneDrive\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp8266.h:107,
from C:\Users\mrang\Downloads\New folder\Test_Blynk\Test_Blynk.ino:6:
c:\Users\mrang\OneDrive\Documents\Arduino\libraries\Blynk\src/BlynkWidgets.h:20:7: note: previous definition of ‘class VPinWriteOnChange’
20 | class VPinWriteOnChange {
| ^~~~~~~~~~~~~~~~~
Multiple libraries were found for “ESP8266WiFi.h”
Used: C:\Users\mrang\OneDrive\Documents\Arduino\libraries\ESP8266WiFi
Not used: C:\Users\mrang\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266WiFi
Multiple libraries were found for “ESP8266WebServer.h”
Used: C:\Users\mrang\OneDrive\Documents\Arduino\libraries\ESP8266WebServer
Not used: C:\Users\mrang\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266WebServer
My code:
#define BLYNK_PRINT Serial
#define BLYNK_TEMPLATE_ID ""
#define BLYNK_TEMPLATE_NAME "Water quality monitoring system"
#define BLYNK_AUTH_TOKEN ""
#include <ESP8266WiFi.h> // Thư viện WiFi cho ESP8266
#include <BlynkSimpleEsp8266.h> // Thư viện Blynk cho ESP8266
char auth[] = ""; // Nhập mã xác thực từ ứng dụng Blynk
char ssid[] = "SongAnhT1"; // Tên mạng WiFi của bạn
char pass[] = "songanht1_1204@"; // Mật khẩu mạng WiFi của bạn
#include "BlynkEdgent.h"
void setup() {
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
}
void loop() {
if (Serial.available()) {
String data = Serial.readStringUntil('\n');
Serial.print("Received data: ");
Serial.println(data);
// Parse data
int commaIndex1 = data.indexOf(",");
int commaIndex2 = data.indexOf(",", commaIndex1 + 1);
float pHValue = data.substring(0, commaIndex1).toFloat();
int tdsValue = data.substring(commaIndex1 + 1, commaIndex2).toInt();
float turbidityValue = data.substring(commaIndex2 + 1).toFloat();
// Send data to Blynk
Blynk.virtualWrite(V1, pHValue);
Blynk.virtualWrite(V2, tdsValue);
Blynk.virtualWrite(V3, turbidityValue);
}
Blynk.run();
}
how can i solve this error?
please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly. Triple backticks look like this: ```
Have you modified your old code to work with the new platform?
There seems to be many problems. My suggestion would be to start from the scratch.
Read this
https://docs.blynk.io/en/blynk-1.0-and-2.0-comparison/migrate-from-1.0-to-2.0
Follow the steps to migrate your old code to work with the new platform.
when i start to write new code i get error : BlynkEdgent.h: No such file or directory
Blynk Edgent is a complicated example sketch which uses many additional .h files (which appear as tabs in the Arduino IDE).
I suspect that you have downloaded the Edgent .ino file from somewhere, but have not downloaded the accompanying .h files.
If you want to use Blynk Edgent then you should go to Files > Examples > Blynk.Edgent then choose the example which suits your board.
However, when you use Blynk Edgent you cannot include lines like this…
because the Auth Token and WiFi credentials are provisioned via the Blynk app, not hard-coded into the sketch.
I think you would be better choosing one of the non-Edgent examples for your project.
Also, Blynk doesn’t like it when you put code like this in your void loop…
You should read this…
https://docs.blynk.io/en/legacy-platform/legacy-articles/keep-your-void-loop-clean
I’m guessing that your project is using an Arduino with your sensors attached, then sending the data via serial communications to an ESP8266 so that it can be sent to Blynk.
This is a very bad idea.
You should choose a suitable board (and ESP32 probably) to allow everything to be done with one board, not two.
Pete.