Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit251e5a1

Browse files
committed
Fixed Neopixel
1 parent4361e40 commit251e5a1

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-
constint PIN=13;
26-
Adafruit_NeoPixel strip = Adafruit_NeoPixel(32, PIN, NEO_GRB + NEO_KHZ800);
27-
2825
// Set these to run example.
2926
#defineFIREBASE_HOST"example.firebaseio.com"
3027
#defineFIREBASE_AUTH"token_or_secret"
3128
#defineWIFI_SSID"SSID"
3229
#defineWIFI_PASSWORD"PASSWORD"
3330

31+
constint 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-
voidConnectWifi(const String& ssid,const String& password ="") {
37-
if (password !="") {
38-
WiFi.begin(ssid, password);
39-
}else {
40-
WiFi.begin(ssid);
41-
}
37+
voidsetup() {
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-
voidsetup() {
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)

[8]ページ先頭

©2009-2025 Movatter.jp