Last active
September 26, 2017 13:59
-
-
Save hocarm/59bb8d99f2fe1f2aca29e74e99ed67bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ESP8266WiFi.h> | |
#include <FirebaseArduino.h> | |
#define FIREBASE_HOST "hocarm1.firebaseio.com" //Thay bằng địa chỉ firebase của bạn | |
#define FIREBASE_AUTH "" //Không dùng xác thực nên không đổi | |
#define WIFI_SSID "ten_wifi" //Thay wifi và mật khẩu | |
#define WIFI_PASSWORD "mat_khau" | |
void setup() { | |
Serial.begin(9600); | |
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); | |
} | |
void loop() { | |
Firebase.setFloat("led", 0); | |
int i = 0; | |
for (i = 0; i < 10; i++) { | |
Firebase.setFloat("led", i); | |
// handle error | |
if (Firebase.failed()) { | |
Serial.print("setting /number failed:"); | |
Serial.println(Firebase.error()); | |
return; | |
} | |
Serial.println(i); | |
delay(200); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment