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

Commit 615dfe4

Browse files
committed
Merge pull request #36 from proppy/bitcoin-ticker
bitcoin ticker
2 parents 2658a0d + fed7633 commit 615dfe4

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

examples/FirebaseStream_ESP8266/FirebaseStream_ESP8266.ino

+20-4
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 stream on a firebase child
18-
// node.
17+
// FirebaseStream_ESP8266 is a sample that stream bitcoin 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+
#define OLED_RESET 10
25+
Adafruit_SSD1306 display(OLED_RESET);
26+
27+
Firebase fbase = Firebase("publicdata-cryptocurrency.firebaseio.com");
2328

2429
void setup() {
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)