Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit615dfe4

Browse files
committed
Merge pull requestFirebaseExtended#36 from proppy/bitcoin-ticker
bitcoin ticker
2 parents2658a0d +fed7633 commit615dfe4

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

‎examples/FirebaseStream_ESP8266/FirebaseStream_ESP8266.ino

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,24 @@
1414
// limitations under the License.
1515
//
1616

17-
// FirebaseStream_ESP8266 is a sample that streamon a firebase child
18-
//node.
17+
// FirebaseStream_ESP8266 is a sample that streambitcoin price from a
18+
//public Firebase and optionally display them on a OLED i2c screen.
1919

2020
#include<Firebase.h>
21+
#include<Adafruit_GFX.h>
22+
#include<Adafruit_SSD1306.h>
2123

22-
Firebase fbase = Firebase("example.firebaseio.com");
24+
#defineOLED_RESET10
25+
Adafruit_SSD1306display(OLED_RESET);
26+
27+
Firebase fbase = Firebase("publicdata-cryptocurrency.firebaseio.com");
2328

2429
voidsetup() {
2530
Serial.begin(9600);
2631

32+
display.begin(SSD1306_SWITCHCAPVCC,0x3C);// initialize with the I2C addr 0x3C (for the 128x32)
33+
display.display();
34+
2735
// connect to wifi.
2836
WiFi.begin("SSID","PASSWORD");
2937
Serial.print("connecting");
@@ -35,7 +43,7 @@ void setup() {
3543
Serial.print("connected:");
3644
Serial.println(WiFi.localIP());
3745

38-
fbase.stream("/chat");
46+
fbase.stream("/bitcoin");
3947
}
4048

4149

@@ -52,6 +60,14 @@ void loop() {
5260
if (type != Firebase::Event::UNKNOWN) {
5361
Serial.print("data:");
5462
Serial.println(event);
63+
64+
// TODO(proppy): parse JSON object.
65+
display.clearDisplay();
66+
display.setTextSize(1);
67+
display.setTextColor(WHITE);
68+
display.setCursor(0,0);
69+
display.println(event);
70+
display.display();
5571
}
5672
}
5773
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp