• GoDaddy Community
  • Website Design & Development
  • Website Design & Development

    cancel
    Showing results for 
    Show  only  | Search instead for 
    Did you mean: 

    how to connect godadday database to esp8266 wifi module

    i used firebase but now problem is i want to use godaddy database what i write in host and aut field and how to add go daddy library in arduino..
    #include <ESP8266WiFi.h>
    #include<FirebaseArduino.h>

    #define FIREBASE_HOST "xxxx.firebaseio.com"
    #define FIREBASE_AUTH "xxxxxxxxxxxxxxxxxxxxxxx"
    const char *ssid = "xxxxxxxxxxxxxx";
    const char *password = "xxxxxxxxxxxxxxx";
    #define Relay1 5 //D1
    int val1;

    #define Relay2 0 //D3
    int val2;

    #define Relay3 14 //D5
    int val3;

    #define Relay4 12 //D6
    int val4;

    void setup()
    {
    Serial.begin(115200);
    pinMode(Relay1,OUTPUT);
    pinMode(Relay2,OUTPUT);
    pinMode(Relay3,OUTPUT);
    pinMode(Relay4,OUTPUT);

    digitalWrite(Relay1,HIGH);
    digitalWrite(Relay2,HIGH);
    digitalWrite(Relay3,HIGH);
    digitalWrite(Relay4,HIGH);
    Serial.print("connecting");
    while (WiFi.status()!=WL_CONNECTED){
    Serial.print(".");
    delay(500);
    }
    Serial.println();
    Serial.print("connected:");
    Serial.println(WiFi.localIP());

    Firebase.begin(FIREBASE_HOST,FIREBASE_AUTH);

    }
    void firebasereconnect()
    {
    Serial.println("Trying to reconnect");
    Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
    }

    void loop()
    {
    if (Firebase.failed())
    {
    Serial.print("setting number failed:");
    Serial.println(Firebase.error());
    firebasereconnect();
    return;
    }

    val1=Firebase.getString("led1").toInt(); //Reading the value of the varialble Status from the firebase

    if(val1==1) // If, the Status is 1, turn on the Relay1
    {
    digitalWrite(Relay1,LOW);
    Serial.println("light 1 ON");
    }
    else if(val1==0) // If, the Status is 0, turn Off the Relay1
    {
    digitalWrite(Relay1,HIGH);
    Serial.println("light 1 OFF");
    }

    val2=Firebase.getString("led2").toInt(); //Reading the value of the varialble Status from the firebase

    if(val2==1) // If, the Status is 1, turn on the Relay2
    {
    digitalWrite(Relay2,LOW);
    Serial.println("light 2 ON");
    }
    else if(val2==0) // If, the Status is 0, turn Off the Relay2
    {
    digitalWrite(Relay2,HIGH);
    Serial.println("light 2 OFF");
    }

    val3=Firebase.getString("led3").toInt(); //Reading the value of the varialble Status from the firebase

    if(val3==1) // If, the Status is 1, turn on the Relay3
    {
    digitalWrite(Relay3,LOW);
    Serial.println("light 3 ON");
    }
    else if(val3==0) // If, the Status is 0, turn Off the Relay3
    {
    digitalWrite(Relay3,HIGH);
    Serial.println("light 3 OFF");
    }

    val4=Firebase.getString("led4").toInt(); //Reading the value of the varialble Status from the firebase

    if(val4==1) // If, the Status is 1, turn on the Relay4
    {
    digitalWrite(Relay4,LOW);
    Serial.println("light 4 ON");
    }
    else if(val4==0) // If, the Status is 0, turn Off the Relay4
    {
    digitalWrite(Relay4,HIGH);
    Serial.println("light 4 OFF");
    }
    }

     

    0 REPLIES 0