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

bitcoin ticker #36

Merged
merged 3 commits into from
Jan 8, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions examples/FirebaseStream_ESP8266/FirebaseStream_ESP8266.ino
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,24 @@
// limitations under the License.
//

// FirebaseStream_ESP8266 is a sample that stream on a firebase child
// node.
// FirebaseStream_ESP8266 is a sample that stream bitcoin price from a
// public Firebase and optionally display them on a OLED i2c screen.

#include <Firebase.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

Firebase fbase = Firebase("example.firebaseio.com");
#define OLED_RESET 10
Adafruit_SSD1306 display(OLED_RESET);

Firebase fbase = Firebase("publicdata-cryptocurrency.firebaseio.com");

void setup() {
Serial.begin(9600);

display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32)
display.display();

// connect to wifi.
WiFi.begin("SSID", "PASSWORD");
Serial.print("connecting");
Expand All @@ -35,7 +43,7 @@ void setup() {
Serial.print("connected: ");
Serial.println(WiFi.localIP());

fbase.stream("/chat");
fbase.stream("/bitcoin");
}


Expand All @@ -52,6 +60,14 @@ void loop() {
if (type != Firebase::Event::UNKNOWN) {
Serial.print("data: ");
Serial.println(event);

// TODO(proppy): parse JSON object.
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.println(event);
display.display();
}
}
}