Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conncion refuse while connecting Firebase using ESP32 #10

Open
vfirebase opened this issue Oct 23, 2021 · 0 comments
Open

Conncion refuse while connecting Firebase using ESP32 #10

vfirebase opened this issue Oct 23, 2021 · 0 comments

Comments

@vfirebase
Copy link

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");

}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant