How to use Firebase with Arduino Uno

How can I use FirebaseArduino with ESP8266? I tried this code:

/*Before Building The Project You Can Simply Test 
The Firebase Database Functionality Using This Code*/


#include <ESP8266WiFi.h>
#include <FirebaseArduino.h>

#define FIREBASE_HOST "[red.].firebaseio.com"  
#define FIREBASE_AUTH "[red.]"  
#define WIFI_SSID "PASTE THE WIFI SSID"
#define WIFI_PASSWORD "PASTE THE WIFI PASSWORD"

void setup() {
  Serial.begin(115200);

  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  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 loop() {
  Serial.println("Sending_Data");

  Firebase.setFloat("test", 1.0);
  delay(5000);
  Firebase.setFloat("test", 42.0);
  delay(5000);
  Firebase.setFloat("test", 31.76);
  delay(5000);

  if (Firebase.failed()) {
    Serial.println("Firebase log sending failed");
    Serial.println(Firebase.error());
    return;
  }
}

But it can't find ESP8266WiFi, so I changed it to ESP8266 which got it past that line, but now FirebaseArduino is saying this error:

In file included from C:\Users\Boston\Desktop\FirebaseTest\FirebaseTest.ino:6:0:
c:\Users\Boston\Documents\Arduino\libraries\FirebaseArduino\src/FirebaseArduino.h:20:10: fatal error: string: No such file or directory
 #include <string>
          ^~~~~~~~
compilation terminated.

exit status 1

Compilation error: exit status 1

To confirm, I am NOT trying to use the ESP8266 with the Arduino IDE. I want to use the Arduino Uno to get data from the Internet and use it for other things. Please help, thanks.

That code is not compatible with an AVR processor such as on an Uno board. It's meant to run on the ESP8266 itself.

2 Likes

How can I use it with the Arduino then? I have other things plugged into the microcontroller like an RFID sensor, so that I can post to the db when the sensor is scanned.

You can't. You'll either have to use code that's compatible with an Uno or switch to a board that's compatible with the code you have.

2 Likes

But is it possible to use it with Arduino if I have the right code? Can i use FirebaseArduino for it? If not, what can I use/do?

I've never used Firebase. Random Nerd Tutorials has lots of Firebase projects and their articles are usually pretty good.

1 Like

Theirs are all for independent ESP8266 I think. Can I just make HTTP requests?

As I said,

I mean, I know you can interface Firebase with a REST API, but am I able to send HTTP requests with all this?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.