25
25
#define PIN 13
26
26
Adafruit_NeoPixel strip = Adafruit_NeoPixel(32 , PIN, NEO_GRB + NEO_KHZ800);
27
27
28
+ #define JSON_BUFFER_SIZE 10 *4
28
29
29
30
// TODO: Replace with your own credentials and keep these safe.
30
- Firebase fbase = Firebase(" brilliant-fire-9638 .firebaseio.com" )
31
- .auth(" llXzJtqwdiHCHw6F6sehQR2EPwbO0YYdhEjPRZxG " );
31
+ Firebase fbase = Firebase(" YOUR-PROJECT-ID .firebaseio.com" )
32
+ .auth(" YOUR_AUTH_SECRET " );
32
33
33
34
void setup () {
34
35
Serial.begin (9600 );
@@ -37,6 +38,7 @@ void setup() {
37
38
strip.setBrightness (25 ); // 0 ... 255
38
39
strip.show (); // Initialize all pixels to 'off'
39
40
41
+ // Not connected, set the LEDs red
40
42
colorWipe (&strip, 0xFF0000 , 50 );
41
43
42
44
// connect to wifi.
@@ -74,7 +76,7 @@ void loop() {
74
76
75
77
// Use dynamic for large JSON objects
76
78
// DynamicJsonBuffer jsonBuffer;
77
- StaticJsonBuffer<JSON_OBJECT_SIZE (10 * 4 )> jsonBuffer;
79
+ StaticJsonBuffer<JSON_OBJECT_SIZE (JSON_BUFFER_SIZE )> jsonBuffer;
78
80
79
81
// create an empty object
80
82
String ref = get.json ();
@@ -87,17 +89,6 @@ void loop() {
87
89
String pixelVal = pixelJSON[pixelAddress];
88
90
Serial.println (pixelVal);
89
91
strip.setPixelColor (i, pixelVal.toInt ());
90
-
91
- // Don't do this: it will waste tons of memory due to the way that the
92
- // Arduino JSON library handles elements.
93
- /*
94
- int r = (uint32_t) pixelJSON[pixelAddress]["r"];
95
- int g = (uint32_t) pixelJSON[pixelAddress]["g"];
96
- int b = (uint32_t) pixelJSON[pixelAddress]["b"];
97
-
98
- Serial.println("Setting [" + String(i) + "] to {" + String(r) + "," + String(g) + "," + String(b) + "}");
99
- strip.setPixelColor(i, strip.Color(r, g, b));
100
- */
101
92
}
102
93
strip.show ();
103
94
} else {
0 commit comments