Uno with ESP-01 (SoftwareSerial) on connecting to Firebase

I previously connected my ESP-01 to Thingspeak but it wasn’t a real-time so I decided to switch into Firebase and I had no enough tutorials to learn from using ESP-01 to Firebase

I posted a new topic so that I might be help by you guys on my working project

I want the device to connect online (real-time)

The code of my project to ThingSpeak is attached

any help please I had no enough sleep just to make this (ESP-01) work on Firebase
I always see NodeMCU in almost all tutorials online

 #include "SoftwareSerial.h"
       #include "DHT.h"
       SoftwareSerial ESP8266(10,11);
       #define DEBUG true
       #define TRIGGER_PIN 4
       #define ECHO_PIN 3
       #define DHTPIN 2  
       #define DHTTYPE DHT11
       
       DHT dht(DHTPIN, DHTTYPE);
       #define FIREBASE_URL      "thesis1-69.firebaseio.com"
       #define FIREBASE_SECRET   "MI3ZrLNP8YrtJbZqcr2vazG8x7wPh5cheiCyR1rM"
       unsigned long previousMillis = 0;
       const long interval = 2000;
       unsigned char check_connection=0; 
       unsigned char times_check=0;  
         
       void debug(String data)
       {
         Serial.println(data);
       }
       void setup() 
       {
         
         dht.begin();                  
         Serial.begin(9600);            
         ESP8266.begin(9600); 
         dht.begin();
         pinMode(TRIGGER_PIN, OUTPUT);
         pinMode(ECHO_PIN, INPUT);
         ESP8266.println("AT+RST"); 
         delay(2000); 
         Serial.println("Connecting to Wifi"); 
         while(check_connection==0)      
         { 
         Serial.print("."); 
         ESP8266.print("AT+CWJAP=\"c902b6\",\"262459105\"\r\n");
         ESP8266.setTimeout(5000); 
         if(ESP8266.find("WIFI CONNECTED\r\n")==1) 
         { 
          Serial.println("WIFI CONNECTED"); 
          break; 
          } 
           times_check++; 
           if(times_check>3) 
           { 
           times_check=0; 
           Serial.println("Trying to Reconnect.."); 
           } 
           } 
          firebase.begin(FIREBASE_URL,FIREBASE_SECRET);                
          firebase.close();            
          previousMillis =  millis(); 
          }
          void loop() 
          {
          unsigned long currentMillis = millis();     
          if (currentMillis - previousMillis >= interval)        
          {       
          if(ret==1)
          { 
             float h = dht.readHumidity();     
             float t = dht.readTemperature();  
             digitalWrite(TRIGGER_PIN, LOW);
             delayMicroseconds(2);
             digitalWrite(TRIGGER_PIN, HIGH);
             delayMicroseconds(10);
             digitalWrite(TRIGGER_PIN, LOW);                                  
             duration = pulseIn(ECHO_PIN,HIGH);
             distance = duration*0.034/2;
                       
             Serial.println("Set Distance = "+String(distance));
             firebase.setFloat("Distance",distance); 
             Serial.println("Set Temperature = "+String(t));
             firebase.setFloat("Temperature",t);  
             Serial.println("Set Humidity = "+String(t));
             firebase.setFloat("Humidity",h);
            }
            firebase.close();              
            previousMillis = currentMillis;
            }
            }

thingspeak_final.ino (3.17 KB)

Edit your posts and insert code tags.

sirI need your help

 #define FIREBASE_URL      "thesis1-69.firebaseio.com"

That's not an URL but a host name. If you provide a link to the library you used we might be able to check if it expects a host name or a URL. BTW, where did you include that library? Where did you define the "firebase" variable?

Learn to format your code! The IDE may help you with the AutoFormat tool (Ctrl-T).

Are you sure that you want to start with a project that connects to a cloud database? I strongly suggest that you start with easier projects so you get familiar with the IDE and the basics of the Arduino platform. Are you able to read the DHT sensor and print it's values to the serial monitor? If you haven't checked that, try that first.

Post a wiring diagram of your complete setup!

I already started on smaller project like connecting it

local network
thingspeak

but the hardest one is this Firebase

here's the link of the library

that URL was a codename only but it was for HOST

Does the code compile for you?

         Serial.begin(9600);            
         Serial.begin(115200);

Why do you define two baudrates immediately following each other?

On what model of Arduino should that code run?

ah it was a mistake sorry

I repeat: Does the code compile for you?

no sir

sir what do you think is the error?

I found this but I don't know how to edit this

I still can't get any way to connect uno to esp to firebase please guys I need your help and guidance :frowning:

biancadelos:
I still can't get any way to connect uno to esp to firebase please guys I need your help and guidance :frowning:

no one did it. everything that works is for esp8266 sketch, not for Uno