user77888: The L1 is the value i will get from firebase database, but now i wanna send the value that i receive in realtime database to arduino to on LED, how to solve? any suggestion? which mean when arduino receive value 1 from firebase then led will on
ESP8266 code :
#include <ESP8266WiFi.h>
#include <FirebaseArduino.h>

// Set these to run 
#define FIREBASE_HOST ""
#define FIREBASE_AUTH ""
#define WIFI_SSID "Home "
#define WIFI_PASSWORD ""

int value1;

void setup() {
  //Initializes the serial connection at 9600 get sensor data from arduino.
  Serial.begin(9600);
   
  delay(1000);
  
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  while (WiFi.status() != WL_CONNECTED) 
  {
    delay(500);  
  }

  Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH); 
  Firebase.setInt("L1",0);  
}

void loop() 
{
  while(Serial.available())
  { 
        value1 =  Firebase.getString("L1").toInt();  
  }
  
  delay(1000);
}

Arduino code:
#define LED 13;

int value1;

void setup()
{
  pinMode(LED,OUTPUT);
  Serial.begin();
}

void loop()
{
  if (value1 == 1)
  {
     digitalWrite(LED, HIGH);
  }
}


user78207: ESP8266 code :
   #include <ESP8266WiFi.h>
#include <FirebaseArduino.h>

// Set these to run 
#define FIREBASE_HOST ""
#define FIREBASE_AUTH ""
#define WIFI_SSID "Home "
#define WIFI_PASSWORD ""

int value1;
String string_value;
void setup() {
  //Initializes the serial connection at 9600 get sensor data from arduino.
  Serial.begin(9600);
   
  delay(1000);
  
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  while (WiFi.status() != WL_CONNECTED) 
  {
    delay(500);  
  }

  Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH); 
  Firebase.setInt("L1",0);  
}

void loop() 
{
 
        value1 =  Firebase.getString("L1").toInt(); 
        string_value = String(value1);
        Serial.print(string_value);
         
  
  
  delay(1000);
}

Arduino code:
    #define LED 13

int value1;
String data;

void setup()
{
  pinMode(LED,OUTPUT);
  Serial.begin(9600);
}

void loop()
{

  bool Sr =false;
 
  while(Serial.available()){
    
        
        data=Serial.readString(); 
        value1 =data.toInt();
        Sr=true;    
        
    }

    delay(500);

    if(Sr){
      
        if (value1 == 1)
        {
           digitalWrite(LED, HIGH);
        }else if(value1 == 0){
          
            digitalWrite(LED, LOW);
          }
   }
}

For More details:
https://www.youtube.com/watch?v=ji71cHaGW8w

77888: <p>The L1 is the value i will get from firebase database, but now i wanna send the value that i receive in realtime database to arduino to on LED, how to solve? any suggestion? which mean when arduino receive value 1 from firebase then led will on</p>
<p>ESP8266 code :</p>
<pre><code>#include &lt;ESP8266WiFi.h&gt;
#include &lt;FirebaseArduino.h&gt;

// Set these to run 
#define FIREBASE_HOST &quot;&quot;
#define FIREBASE_AUTH &quot;&quot;
#define WIFI_SSID &quot;Home &quot;
#define WIFI_PASSWORD &quot;&quot;

int value1;

void setup() {
  //Initializes the serial connection at 9600 get sensor data from arduino.
  Serial.begin(9600);
   
  delay(1000);
  
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  while (WiFi.status() != WL_CONNECTED) 
  {
    delay(500);  
  }

  Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH); 
  Firebase.setInt(&quot;L1&quot;,0);  
}

void loop() 
{
  while(Serial.available())
  { 
        value1 =  Firebase.getString(&quot;L1&quot;).toInt();  
  }
  
  delay(1000);
}
</code></pre>
<p>Arduino code:</p>
<pre><code>#define LED 13;

int value1;

void setup()
{
  pinMode(LED,OUTPUT);
  Serial.begin();
}

void loop()
{
  if (value1 == 1)
  {
     digitalWrite(LED, HIGH);
  }
}
</code></pre>
 78207: <p>ESP8266 code :</p>
<pre><code>   #include &lt;ESP8266WiFi.h&gt;
#include &lt;FirebaseArduino.h&gt;

// Set these to run 
#define FIREBASE_HOST &quot;&quot;
#define FIREBASE_AUTH &quot;&quot;
#define WIFI_SSID &quot;Home &quot;
#define WIFI_PASSWORD &quot;&quot;

int value1;
String string_value;
void setup() {
  //Initializes the serial connection at 9600 get sensor data from arduino.
  Serial.begin(9600);
   
  delay(1000);
  
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  while (WiFi.status() != WL_CONNECTED) 
  {
    delay(500);  
  }

  Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH); 
  Firebase.setInt(&quot;L1&quot;,0);  
}

void loop() 
{
 
        value1 =  Firebase.getString(&quot;L1&quot;).toInt(); 
        string_value = String(value1);
        Serial.print(string_value);
         
  
  
  delay(1000);
}
</code></pre>
<p>Arduino code:</p>
<pre><code>    #define LED 13

int value1;
String data;

void setup()
{
  pinMode(LED,OUTPUT);
  Serial.begin(9600);
}

void loop()
{

  bool Sr =false;
 
  while(Serial.available()){
    
        
        data=Serial.readString(); 
        value1 =data.toInt();
        Sr=true;    
        
    }

    delay(500);

    if(Sr){
      
        if (value1 == 1)
        {
           digitalWrite(LED, HIGH);
        }else if(value1 == 0){
          
            digitalWrite(LED, LOW);
          }
   }
}
</code></pre>
<p>For More details:</p>
<p><a href="https://www.youtube.com/watch?v=ji71cHaGW8w" rel="nofollow noreferrer">https://www.youtube.com/watch?v=ji71cHaGW8w</a></p>
