我已通过串行通信将值从Arduino mega传输到nodeMCU。但是我无法将值传输到Firebase。发生错误-
针对板载NodeMCU 1.0(ESP-12E模块)的编译错误
这是代码:
#include <ESP8266WiFi.h>
#include <FirebaseArduino.h>
// Set these to run example.
#define FIREBASE_HOST "https://agro-775df.firebaseio.com/"
#define FIREBASE_AUTH "YRyEHN5YcQ4DSdviYX5ciiqWQBwQmhAIneFlcXbK"
#define WIFI_SSID "vintage"
#define WIFI_PASSWORD "barapi"
String str;
char bu[10];
int one,two,three;
int temp,humi;
void setup()
{
Serial.begin(115200);
// connect to wifi.
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("connecting");
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
Serial.println();
Serial.print("connected: ");
Serial.println(WiFi.localIP());
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
while(!Serial)uj{
}
}
int n = 0;
void loop() {
if (Serial.available())
{
str=Serial.readString();
}
// set string value
Firebase.setString("message",str);
// handle error
if (Firebase.failed())
{
Serial.print("setting /message failed:");
`` Serial.println(Firebase.error());
return;
}
delay(1000);
}
答案 0 :(得分:0)