blynkkk / blynk-library

Blynk library for IoT boards. Works with Arduino, ESP32, ESP8266, Raspberry Pi, Particle, ARM Mbed, etc.
https://blynk.io
MIT License
3.81k stars 1.38k forks source link

Connecting to blynk.cloud:80 #580

Closed nisanisa22 closed 1 year ago

nisanisa22 commented 1 year ago

Blynk library version: [1.2.0] IDE: [Arduino] IDE version: [2.0.4] Board type: [NodeMCU 1.0(ESP-12E Module]

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/)

This is my code:

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = "xxxx";// Enter your Auth token
char ssid[] = "xxxx";//Enter your WIFI SSIS
char pass[] = "xxxx";//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
John93-Blynk commented 1 year ago

Your serial monitor says "Ready (ping: 84ms)." Which indicates that your device is successfully connected to the blynk cloud.

nisanisa22 commented 1 year ago

Thank you!