Skip to main content

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.ino 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.ino Arduino code:

#define LED 13;

int value1;

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

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

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.ino

#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.ino

#define LED 13;

int value1;

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

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

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);
  }
}
Post Migrated Here from electronics.stackexchange.com (revisions)
Source Link

How to send data from esp-01 Wi-Fi module to arduino

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.ino

#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.ino

#define LED 13;

int value1;

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

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