View voltage from firebase
Posted: Tue Jan 03, 2023 5:46 pm
View voltage from firebase
Can you please help me this project is not working
#include <ESP8266WiFi.h>
#include <FirebaseArduino.h>
#define FIREBASE_HOST "..........."
#define FIREBASE_AUTH "..........."
// Replace with your WiFi SSID and password
const char* ssid = ".....";
const char* password = ".....";
// The voltage sensor is connected to analog input A0
const int sensorPin = A0;
// The voltage sensor has a range of 0-25V and a resolution of 1mV
const float sensorRange = 25.0;
const float sensorResolution = 0.001;
void setup() {
Serial.begin(9600);
// Connect to WiFi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println();
Serial.print("Connected to WiFi, IP address: ");
Serial.println(WiFi.localIP());
// Connect to Firebase
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
}
void loop() {
// Read the raw sensor value
int sensorValue = analogRead(sensorPin);
// Convert the raw sensor value to volts
float voltage = sensorValue * (sensorRange / 1023.0) / sensorResolution;
// Send the voltage data to Firebase
Firebase.setFloat("voltage", voltage);
delay(1000);
}
Can you please help me this project is not working
#include <ESP8266WiFi.h>
#include <FirebaseArduino.h>
#define FIREBASE_HOST "..........."
#define FIREBASE_AUTH "..........."
// Replace with your WiFi SSID and password
const char* ssid = ".....";
const char* password = ".....";
// The voltage sensor is connected to analog input A0
const int sensorPin = A0;
// The voltage sensor has a range of 0-25V and a resolution of 1mV
const float sensorRange = 25.0;
const float sensorResolution = 0.001;
void setup() {
Serial.begin(9600);
// Connect to WiFi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println();
Serial.print("Connected to WiFi, IP address: ");
Serial.println(WiFi.localIP());
// Connect to Firebase
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
}
void loop() {
// Read the raw sensor value
int sensorValue = analogRead(sensorPin);
// Convert the raw sensor value to volts
float voltage = sensorValue * (sensorRange / 1023.0) / sensorResolution;
// Send the voltage data to Firebase
Firebase.setFloat("voltage", voltage);
delay(1000);
}