Test Code
Test Code
Monitoring Project by using ARDUINO IDE SOFTWARE. The code is provided below:
#include <Firebase.h>
#include <FirebaseArduino.h>
#include <FirebaseCloudMessaging.h>
#include <FirebaseError.h>
#include <FirebaseHttpClient.h>
#include <FirebaseObject.h>
#include <ESP8266WiFi.h>
#include <FirebaseArduino.h>
void setup() {
Serial.begin(9600);
pinMode(A0,INPUT);
// connect to wifi.
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("connecting");
Serial.print(".");
delay(500);
Serial.println();
Serial.print("connected: ");
Serial.println(WiFi.localIP());
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
void loop() {
double ppm_log = (log10(ratio)-b)/m; //Get ppm value in linear scale according to the the ratio
value
Serial.println(ppm);
Firebase.setFloat("Volt",sensor_volt);
if(0<ppm<250)
//handle error
if (Firebase.failed()) {
Serial.println(Firebase.error());
return;
} }
else if(250<ppm<500)
//handle error
if (Firebase.failed()) {
Serial.println(Firebase.error());
return;
else
// handle error
if (Firebase.failed()) {
Serial.println(Firebase.error());
return;
} }
delay(30000);