Hi everyone, i need some help, i’m doing my ioT project, which is a gas leak detector that uses the ESP8266 microcontroller(nodeMCU) and the Blynk IoT platform to notify the user of potential gas leaks. However, i cannot fix this error. I really need your help. Thank you!
I chose to base my final IoT project on this gas leakage monitoring system from (https://srituhobby.com/iot-based-gas-leakage-monitoring-system/)
I used Blynk latest version (1.2.0)
This is my code:
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "xxxxxxx";// Enter your Auth token
char ssid[] = "xxxxxxx";//Enter your WIFI SSIS
char pass[] = "xxxxxx";//Enter your WIFI password
BlynkTimer timer;
int pinValue = 0;
#define Buzzer D5
#define Yellow D6
#define Green D7
#define Sensor A0
void setup() {
Serial.begin(9600);
pinMode(Yellow, OUTPUT);
pinMode(Green, OUTPUT);
pinMode(Buzzer, OUTPUT);
pinMode(Sensor, INPUT);
Blynk.begin(auth, ssid, pass);
timer.setInterval(100L, notifiaction);
}
BLYNK_WRITE(V0) {
pinValue = param.asInt();
}
void notifiaction() {
int sensor = analogRead(Sensor);
Serial.println(sensor);
sensor = map(sensor, 0, 1024, 0, 100);
if (pinValue == 1) {
if (sensor <= 50) {
digitalWrite(Yellow, HIGH);
digitalWrite(Green, LOW);
digitalWrite(Buzzer, LOW);
} else if (sensor > 50) {
Blynk.logEvent("Warning! Gas leak detected");
digitalWrite(Yellow, LOW);
digitalWrite(Green, HIGH);
digitalWrite(Buzzer, HIGH);
}
Blynk.virtualWrite(V1, sensor);
} else {
digitalWrite(Yellow, LOW);
digitalWrite(Buzzer, LOW);
digitalWrite(Green, LOW);
}
}
void loop() {
Blynk.run();
timer.run();
}
I was able to connect to the WiFi, but I’m not able to connect to the Blynk cloud.
[8027] Connecting to blynk.cloud:80
[8357] Ready (ping: 84ms).
2
3
3
3
5
6
3
2
5