i try to upload my moisture sensor value to firebase. but it's not updating in firebase. If some one can explain why is that. here is code that i upload to esp32
#include <FirebaseESP32.h>
const char* ssid = "";
const char password = "";
FirebaseData firebaseData;
FirebaseConfig config;
FirebaseAuth auth;
#define AOUT_PIN 35 // ESP32 pin GPIO35 (ADC1_0) that connects to AOUT pin of the moisture sensor
void setup() {
Serial.begin(9600);
// Connect to Wi-Fi
WiFi.begin(ssid, password);
Serial.print("Connecting to Wi-Fi");
while (WiFi.status() != WL_CONNECTED) {
delay(100);
Serial.print(".");
}
Serial.println("");
Serial.println("Connected to Wi-Fi!");
// Initialize Firebase Configuration
config.database_url = "*************";
config.signer.tokens.legacy_token = "**************";
Firebase.begin(&config, &auth);
Serial.print("Connecting to Firebase");
while (!Firebase.ready()) { // Removed the FirebaseData* argument
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("Connected to Firebase!");
}
void loop() {
int moisture_value = analogRead(AOUT_PIN); // Read the analog value from the moisture sensor
Serial.print("Moisture value: ");
Serial.println(moisture_value);
// Send the moisture value to Firebase
String path = "moisture_sensor"; // Firebase path to store the moisture value
Firebase.setInt(firebaseData, path, moisture_value);
delay(500); // Delay for 10 seconds before taking the next reading and sending to Firebase
}