I completed the example to control ESP8266 with the firebase example from your book working nice.
I have another working project (with webserver) in arduinoIDE coded in .ino with an html page and javascripts.
I convert the .ino code into a main.cpp and moved it in a Firebase project. This compiles and deploy’s and seems to function well but not the parts controlling the FirebaseDB .
So I can now control my hardware by means the Firebase control and the index.js and at the same time through the wifi webserver socket.
Would there be a way or an example to connect this all together, switching outputs and updating the FirebasDB
It was my idea to add javascripts to the arduino code (main.cpp) so that the index.js and auth.js combination can be combined with the arduino code.
All help is appreciated and I am prepared to send over the project
Best regards Herman
Hi.
I’m not sure that I understood your question.
So, at the moment you can control GPIOs using a web server and the Firebase app simultaneously, is that it?
And you want to update the database when you use the web server?
To do that, you need to add some code to your Arduino sketch that sends a new value to the database whenever the GPIOs change state.
If you’re using websockets, you can add that code to the callback function that handles new websocket messages.
You can use the regular function to update a database path like
Firebase.RTDB.setInt(&fbdo, "DATABASE_PATH", VALUE)
I hope this helps.
Regards,
Sara