• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Firebase path with variable

Q&A Forum › Category: ESP32 › Firebase path with variable
0 Vote Up Vote Down
Heath Hestand asked 3 years ago

Hi, 
i am trying to get the ESP-NOW program to communicate with firebase.  The program works but the data from 4 AM2302s is put in the same subdirectory, temperature, humidity and ID #, on firebase.  The database is layed out this way:
https://imgur.com/a/Q76Rw8S
Want it to look this way:
https://imgur.com/a/SvxPsRK
The onsite html works great just unsure how to use the ID variable in the path statement.
Arduino code
Thank you

1 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi.
You just need to concatenate the id number with the paths you want to use for temperature and humidity.
Instead of having this line on the setup(), that will only run only once:
database_path = "/Data/AM2302 Readings" + incomingReadings.id ;
 
Put in the loop() so that the id number is updated in any loop(). Add it just before sending the temperature and humidity data. If you actually want to display the “ID” string, you can change it like this:
 
database_path = "/Data/AM2302 Readings/" + "ID" + incomingReadings.id ;
 
I hope this helps.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.