You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//#define FIREBASE_Host "xxxxxxx.firebaseio.com" // replace with your Firebase Host
//#define FIREBASE_authorization_key "Jgq6M6eeyqurhOCL0FB7Mq4Rlat3a6Hcg1*******" // replace with your secret key
//#define Your_SSID "Write_your_SSID" // replace with your SSID
//#define Your_PASSWORD "*********" //replace with your Password
String led_state = ""; // LED State
int led_gpio = 2;
void setup() {
Serial.begin(115200);
delay(1000);
//pinMode(2, OUTPUT);
WiFi.begin(Your_SSID, Your_PASSWORD);
Serial.print("Connecting to WIFI");
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
Serial.println();
Serial.print("Connected to WIFI!");
Serial.println();
Serial.print("IP Address: ");
Serial.println(WiFi.localIP()); //print local IP address
Firebase.begin(FIREBASE_Host, FIREBASE_authorization_key); // connect to firebase
Firebase.setString("Master_Bedroom", "OFF"); //send initial string of led status
PFB code it giving connection refused error
#include <WiFi.h>
#include <IOXhop_FirebaseESP32.h>
//#include <FirebaseArduino.h>
//#include <SoftwareSerial.h>
#include <WiFiClient.h>
#include <DNSServer.h>
//#define FIREBASE_Host "xxxxxxx.firebaseio.com" // replace with your Firebase Host
//#define FIREBASE_authorization_key "Jgq6M6eeyqurhOCL0FB7Mq4Rlat3a6Hcg1*******" // replace with your secret key
//#define Your_SSID "Write_your_SSID" // replace with your SSID
//#define Your_PASSWORD "*********" //replace with your Password
#define FIREBASE_Host "xxxxxxx.firebaseio.com" //client3-33284.firebaseio.com
#define FIREBASE_authorization_key "xxxxxxxrxttU8Ez3bGb4" //EnTrALPdj2L1DmkqDTt4tr9DsrlcTeO8xQhU8OGg
//#define Your_SSID "BA" //Optic Network
//#define Your_PASSWORD "ADVIR123456" //dzinesameersir@2021
#define Your_SSID "Optic Network"
#define Your_PASSWORD "xxxxxxx@2021"
String led_state = ""; // LED State
int led_gpio = 2;
void setup() {
Serial.begin(115200);
delay(1000);
//pinMode(2, OUTPUT);
WiFi.begin(Your_SSID, Your_PASSWORD);
Serial.print("Connecting to WIFI");
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
Serial.println();
Serial.print("Connected to WIFI!");
Serial.println();
Serial.print("IP Address: ");
Serial.println(WiFi.localIP()); //print local IP address
Firebase.begin(FIREBASE_Host, FIREBASE_authorization_key); // connect to firebase
Firebase.setString("Master_Bedroom", "OFF"); //send initial string of led status
}
void loop() {
Firebase.setString("Master_Bedroom", "OFF");
if(Firebase.failed())
{
Serial.println(Firebase.error());
}
led_state = Firebase.getString("Master_Bedroom");
// Serial.println(led_state);
if (led_state == "ON") {
Serial.println("Led is ON");
digitalWrite(led_gpio, HIGH);
}
else if (led_state == "OFF") {
Serial.println("Led is OFF");
digitalWrite(led_gpio, LOW);
}
else
{
//Serial.println("Wrong value entered! Only ON or OFF accepted");
}
}
The text was updated successfully, but these errors were encountered: