Hello,
It's me again im now in face of a unexpected problem.
Last time i managed to get everything right but right now my nodemcu board wont connect to my firebase. I didnt change anything and it just not working blows my head away.
Its like it doesnt get connection to firebase no matter what. It connects to wifi no problem.
Did somebody had similar problem or were there any changes in firebase policy?
#include <ESP8266WiFi.h>
#include <FirebaseArduino.h>
#include <DHT.h>
#define frb_link "arduinzwifi-default-rtdb.firebaseio.com"
#define frb_haslo "ujZf4Q5s4AmI9tXpMaoQYKBfTE3Lp2hk29RA1wb1"
#define wifi_ssid
#define wifi_haslo
#define DHTPIN D2 // Cyfrowy pin podlaczony do sensoru
#define DHTTYPE DHT11 // definiowanie sensoru temperatury //
DHT dht(DHTPIN, DHTTYPE);
String msg1 = " \"Wykryto metal\"";
String msg2 = " \"Nie wykrywa\"";
const int pin=D1;
int state=LOW;
void setup()
{
pinMode(pin, INPUT); // definiuje typ pinu
Serial.begin(9600);
dht.begin(); //odczytuje dane z sensora
WiFi.begin(wifi_ssid, wifi_haslo); // Logowanie do wifi
Serial.print(wifi_ssid);
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
Serial.println();
Serial.print("Polaczono z siecia");
Serial.print("Adres IP: ");
Serial.println(WiFi.localIP()); //wyświetla lokalne ip
Firebase.begin(frb_link); // łączenie do bazy danych
}
void loop()
{
int sensorValue=digitalRead(pin);
if(sensorValue==LOW)
{
Serial.println(msg1); // komunikat w konsoli
Firebase.setString("/project-396230092945/Indukcja", msg1); // Zmiana wpisu w bazie danych
delay(100);
}
else
{
Serial.println(msg2); // komunikat w konsoli
Firebase.setString("/project-396230092945/Indukcja", msg2); // Zmiana wpisu w bazie danych
delay(100);
}
float t = dht.readTemperature(); // Odczyt temperatury w celsjuszach
Serial.print("% Temperatura: ");
Serial.print(t);
Serial.println("°C ");
Firebase.setFloat ("/project-396230092945/Temperatura",t); // wypchniecie do bazy danych wartosci temperatury
delay(100);
}
Can u check the code with ur node mcu perhaps? and i will se if it creates / modifies values in database