Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Commit 13ce951

Browse files
committed
example/FirebasePush: update example to loop
1 parent be1a7da commit 13ce951

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

examples/FirebasePush_ESP8266/FirebasePush_ESP8266.ino

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@
1414
// limitations under the License.
1515
//
1616

17-
// FirebasePush_ESP8266 is a sample that push a new timestamp to firebase
18-
// on each reset.
17+
// FirebasePush_ESP8266 is a sample that push a new value to Firebase
18+
// every seconds.
1919

2020
#include <ESP8266WiFi.h>
21-
2221
#include <FirebaseArduino.h>
2322

2423
void setup() {
@@ -36,17 +35,19 @@ void setup() {
3635
Serial.println(WiFi.localIP());
3736

3837
Firebase.begin("example.firebaseio.com", "auth_or_token");
38+
}
3939

40-
// add a new entry.
41-
String name = Firebase.push("/logs", "{\".sv\": \"timestamp\"}");
40+
int n = 0;
41+
42+
void loop() {
43+
// push a new value.
44+
String name = Firebase.push("/logs", n++);
4245
if (Firebase.failed()) {
43-
Serial.println(" push failed");
46+
Serial.print("push failed: ");
4447
Serial.println(Firebase.error());
4548
return;
4649
}
4750
Serial.print("pushed: ");
4851
Serial.println(name);
49-
}
50-
51-
void loop() {
52+
delay(1000);
5253
}

0 commit comments

Comments
 (0)