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

Commit 251e5a1

Browse files
committed
Fixed Neopixel
1 parent 4361e40 commit 251e5a1

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

examples/Firebase_ESP8266_LEDs/Firebase_ESP8266_Neopixel/Firebase_ESP8266_Neopixel.ino

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,41 +22,45 @@
2222
#include <Adafruit_NeoPixel.h>
2323
#include "colors_ext.h"
2424

25-
const int PIN=13;
26-
Adafruit_NeoPixel strip = Adafruit_NeoPixel(32, PIN, NEO_GRB + NEO_KHZ800);
27-
2825
// Set these to run example.
2926
#define FIREBASE_HOST "example.firebaseio.com"
3027
#define FIREBASE_AUTH "token_or_secret"
3128
#define WIFI_SSID "SSID"
3229
#define WIFI_PASSWORD "PASSWORD"
3330

31+
const int PIN=13;
32+
Adafruit_NeoPixel strip = Adafruit_NeoPixel(32, PIN, NEO_GRB + NEO_KHZ800);
33+
34+
// TODO: Replace with your own credentials and keep these safe.
3435
Firebase fbase = Firebase(FIREBASE_HOST, FIREBASE_AUTH);
3536

36-
void ConnectWifi(const String& ssid, const String& password = "") {
37-
if (password != "") {
38-
WiFi.begin(ssid, password);
39-
} else {
40-
WiFi.begin(ssid);
41-
}
37+
void setup() {
38+
Serial.begin(9600);
4239

40+
strip.begin();
41+
strip.setBrightness(25); // 0 ... 255
42+
strip.show(); // Initialize all pixels to 'off'
43+
44+
// Not connected, set the LEDs red
45+
colorWipe(&strip, 0xFF0000, 50);
46+
47+
// connect to wifi.
48+
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
4349
Serial.print("connecting");
50+
51+
int count = 0;
4452
while (WiFi.status() != WL_CONNECTED) {
53+
// Draw rainbows while connecting
4554
Serial.print(".");
46-
delay(500);
55+
if (count < strip.numPixels()){
56+
strip.setPixelColor(count++, Wheel(&strip, count * 8));
57+
strip.show();
58+
}
59+
delay(20);
4760
}
4861
Serial.println();
4962
Serial.print("connected: ");
5063
Serial.println(WiFi.localIP());
51-
}
52-
53-
void setup() {
54-
Serial.begin(9600);
55-
ConnectWifi(WIFI_SSID, WIFI_PASSWORD);
56-
57-
strip.begin();
58-
strip.setBrightness(25); // 0 ... 255
59-
strip.show(); // Initialize all pixels to 'off'
6064

6165
// Connected, set the LEDs green
6266
colorWipe(&strip, 0x00FF00, 50);

0 commit comments

Comments
 (0)