This repository was archived by the owner on Mar 17, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +5
-15
lines changed
Firebase_ESP8266_LEDs/Firebase_ESP8266_Neopixel Expand file tree Collapse file tree 2 files changed +5
-15
lines changed Original file line number Diff line number Diff line change 2121#include < ESP8266WiFi.h>
2222#include < Adafruit_GFX.h>
2323#include < Adafruit_SSD1306.h>
24- #include < ArduinoJson.h>
2524
2625#define OLED_RESET 3
2726Adafruit_SSD1306 display (OLED_RESET);
@@ -66,8 +65,8 @@ void loop() {
6665 Serial.println (event);
6766 JsonObject& json = buf.parseObject ((char *)event.c_str ());
6867 String path = json[" path" ];
69- float data = json[" data" ];
70-
68+ float data = json[" data" ];
69+
7170 // TODO(proppy): parse JSON object.
7271 display.clearDisplay ();
7372 display.setTextSize (2 );
Original file line number Diff line number Diff line change 2626const int PIN=13 ;
2727Adafruit_NeoPixel strip = Adafruit_NeoPixel(32 , PIN, NEO_GRB + NEO_KHZ800);
2828
29- #define JSON_BUFFER_SIZE 10 *4
30-
3129// TODO: Replace with your own credentials and keep these safe.
32- Firebase fbase = Firebase(" YOUR-PROJECT.firebaseio.com" )
33- .auth(" YOUR_AUTH_SECRET" );
30+ Firebase fbase = Firebase(" YOUR-PROJECT.firebaseio.com" , " YOUR_AUTH_SECRET" );
3431
3532void setup () {
3633 Serial.begin (9600 );
@@ -75,14 +72,8 @@ void loop() {
7572 return ;
7673 }
7774
78- // Use dynamic for large JSON objects
79- // DynamicJsonBuffer jsonBuffer;
80- StaticJsonBuffer<JSON_OBJECT_SIZE (JSON_BUFFER_SIZE)> jsonBuffer;
81-
8275 // create an empty object
83- String ref = get.json ();
84- Serial.println (ref);
85- JsonObject& pixelJSON = jsonBuffer.parseObject ((char *)ref.c_str ());
76+ const JsonObject& pixelJSON = get.json ();
8677
8778 if (pixelJSON.success ()){
8879 for (int i=0 ; i < strip.numPixels (); i++) {
@@ -94,7 +85,7 @@ void loop() {
9485 strip.show ();
9586 } else {
9687 Serial.println (" Parse fail." );
97- Serial.println (get.json ());
88+ Serial.println (get.response ());
9889 }
9990}
10091
You can’t perform that action at this time.
0 commit comments