Go Down

Topic: Send data to Firebase database by POST (Read 1 time) previous topic - next topic


I am using the Arduino YUN to send data information to Firebase via wifi. I can retrieve information from my database (Using the httpclientConsole example in arduino) but I am having a hard time sending data to it. I tried running this code as well and replacing the proper URL: https://forum.arduino.cc/index.php?topic=474536.0
Here is the code that I got from the Firebase references that I'm trying to get to work:

#include <Process.h>
#include <Bridge.h>
#include <Console.h>
void setup()
  Bridge.begin();   // Initialize the Bridge
   Console.begin();  // initialize Console communication

void loop()
  // Simulate Get Sensor value
  int sensor = random(10, 20);
  Process p;
//I put the proper project name which is the name of my database
 p.runShellCommand("curl -X POST -d '{"user_id"  : "jack", "text" : "Ahoy!"}'  'https://[My project name].firebaseio.com/.json' ");


This is where I got the code: https://firebase.google.com/docs/reference/rest/database/

Go Up