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

Commit045e9a9

Browse files
committed
Merge pull requestFirebaseExtended#145 from proppy/update-neopixel
Update neopixel sample
2 parents7d3a128 +b880f14 commit045e9a9

File tree

13 files changed

+84
-170
lines changed

13 files changed

+84
-170
lines changed

‎.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ before_script:
2727
script:
2828
-${ARDUINO_ROOT}/arduino-builder -verbose -hardware ${ARDUINO_ROOT}/hardware/ -tools ${ARDUINO_ESP8266_ROOT}/tools/ -tools ${ARDUINO_ROOT}/tools-builder/ -fqbn esp8266com:esp8266:nodemcuv2 -libraries ${ARDUINO_HOME}/libraries/ -prefs build.flash_ld=${ARDUINO_ESP8266_ROOT}/tools/sdk/ld/eagle.flash.4m.ld -prefs build.flash_freq=40 -prefs build.flash_size=4M examples/FirebaseDemo_ESP8266/FirebaseDemo_ESP8266.ino
2929
-${ARDUINO_ROOT}/arduino-builder -verbose -hardware ${ARDUINO_ROOT}/hardware/ -tools ${ARDUINO_ESP8266_ROOT}/tools/ -tools ${ARDUINO_ROOT}/tools-builder/ -fqbn esp8266com:esp8266:nodemcuv2 -libraries ${ARDUINO_HOME}/libraries/ -prefs build.flash_ld=${ARDUINO_ESP8266_ROOT}/tools/sdk/ld/eagle.flash.4m.ld -prefs build.flash_freq=40 -prefs build.flash_size=4M examples/FirebaseSerialHost_ESP8266/FirebaseSerialHost_ESP8266.ino
30-
-${ARDUINO_ROOT}/arduino-builder -verbose -hardware ${ARDUINO_ROOT}/hardware/ -tools ${ARDUINO_ESP8266_ROOT}/tools/ -tools ${ARDUINO_ROOT}/tools-builder/ -fqbn esp8266com:esp8266:nodemcuv2 -libraries ${ARDUINO_HOME}/libraries/ -prefs build.flash_ld=${ARDUINO_ESP8266_ROOT}/tools/sdk/ld/eagle.flash.4m.ld -prefs build.flash_freq=40 -prefs build.flash_size=4M examples/Firebase_ESP8266_LEDs/Firebase_ESP8266_Neopixel/Firebase_ESP8266_Neopixel.ino
30+
-${ARDUINO_ROOT}/arduino-builder -verbose -hardware ${ARDUINO_ROOT}/hardware/ -tools ${ARDUINO_ESP8266_ROOT}/tools/ -tools ${ARDUINO_ROOT}/tools-builder/ -fqbn esp8266com:esp8266:nodemcuv2 -libraries ${ARDUINO_HOME}/libraries/ -prefs build.flash_ld=${ARDUINO_ESP8266_ROOT}/tools/sdk/ld/eagle.flash.4m.ld -prefs build.flash_freq=40 -prefs build.flash_size=4M examples/FirebaseNeoPixel_ESP8266/FirebaseNeoPixel_ESP8266.ino
3131
-${ARDUINO_ROOT}/arduino-builder -verbose -hardware ${ARDUINO_ROOT}/hardware/ -tools ${ARDUINO_ESP8266_ROOT}/tools/ -tools ${ARDUINO_ROOT}/tools-builder/ -fqbn esp8266com:esp8266:nodemcuv2 -libraries ${ARDUINO_HOME}/libraries/ -prefs build.flash_ld=${ARDUINO_ESP8266_ROOT}/tools/sdk/ld/eagle.flash.4m.ld -prefs build.flash_freq=40 -prefs build.flash_size=4M examples/FirebaseStream_ESP8266/FirebaseStream_ESP8266.ino
3232
-${ARDUINO_ROOT}/arduino-builder -verbose -hardware ${ARDUINO_ROOT}/hardware/ -tools ${ARDUINO_ESP8266_ROOT}/tools/ -tools ${ARDUINO_ROOT}/tools-builder/ -fqbn esp8266com:esp8266:nodemcuv2 -libraries ${ARDUINO_HOME}/libraries/ -prefs build.flash_ld=${ARDUINO_ESP8266_ROOT}/tools/sdk/ld/eagle.flash.4m.ld -prefs build.flash_freq=40 -prefs build.flash_size=4M examples/FirebaseRoom_ESP8266/FirebaseRoom_ESP8266.ino
3333
-( cd test && make check )

‎examples/FirebaseDemo_ESP8266/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ FirebaseDemo is a sample that shows basic usage of the `FirebaseArduino` API.
2828
##Play
2929

3030
1. Go to the Firebase console`Data` section
31-
1. Watch the data being modified as the sketch runs.
31+
1. Watch the data being modified as the sketch runs
Lines changed: 15 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,21 @@
1414
// limitations under the License.
1515
//
1616

17-
//Firebase_ESP8266-Neopixel is a sample that demonstrates how
18-
// to set pixel datausing a firebase stream.
19-
#include<Firebase.h>
17+
//FirebaseNeoPixel is a sample that demonstrates how
18+
// to set pixel datafrom Firebase.
19+
#include<FirebaseArduino.h>
2020
#include<ESP8266WiFi.h>
2121

2222
#include<Adafruit_NeoPixel.h>
23-
#include"colors_ext.h"
2423

2524
// Set these to run example.
2625
#defineFIREBASE_HOST"example.firebaseio.com"
2726
#defineFIREBASE_AUTH"token_or_secret"
2827
#defineWIFI_SSID"SSID"
2928
#defineWIFI_PASSWORD"PASSWORD"
3029

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.
35-
Firebase fbase = Firebase(FIREBASE_HOST, FIREBASE_AUTH);
30+
constint pixelPin =13;
31+
Adafruit_NeoPixel strip = Adafruit_NeoPixel(32, pixelPin, NEO_GRB + NEO_KHZ800);
3632

3733
voidsetup() {
3834
Serial.begin(9600);
@@ -41,56 +37,35 @@ void setup() {
4137
strip.setBrightness(25);// 0 ... 255
4238
strip.show();// Initialize all pixels to 'off'
4339

44-
// Not connected, set the LEDs red
45-
colorWipe(&strip,0xFF0000,50);
46-
4740
// connect to wifi.
4841
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
4942
Serial.print("connecting");
50-
51-
int count =0;
5243
while (WiFi.status() != WL_CONNECTED) {
53-
// Draw rainbows while connecting
5444
Serial.print(".");
55-
if (count < strip.numPixels()){
56-
strip.setPixelColor(count++,Wheel(&strip, count *8));
57-
strip.show();
58-
}
59-
delay(20);
45+
delay(500);
6046
}
6147
Serial.println();
6248
Serial.print("connected:");
6349
Serial.println(WiFi.localIP());
6450

65-
// Connected, set the LEDs green
66-
colorWipe(&strip,0x00FF00,50);
51+
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
6752
}
6853

6954

7055
voidloop() {
7156
// Get all entries.
7257
// TODO: Replace with streaming
73-
FirebaseGet get =fbase.get("/rgbdata");
74-
if (get.error()) {
58+
FirebaseObject pixels =Firebase.get("/rgbdata");
59+
if (Firebase.failed()) {
7560
Serial.println("Firebase get failed");
76-
Serial.println(get.error().message());
61+
Serial.println(Firebase.error());
7762
return;
7863
}
7964

80-
// create an empty object
81-
const JsonObject& pixelJSON = get.json();
82-
83-
if(pixelJSON.success()){
84-
for (int i=0; i < strip.numPixels(); i++) {
85-
String pixelAddress ="pixel" +String(i);
86-
String pixelVal = pixelJSON[pixelAddress];
87-
Serial.println(pixelVal);
88-
strip.setPixelColor(i, pixelVal.toInt());
89-
}
90-
strip.show();
91-
}else {
92-
Serial.println("Parse fail.");
93-
Serial.println(get.response());
65+
for (int i =0; i < strip.numPixels(); i++) {
66+
int pixel = pixels.getInt(String("pixel") + i);
67+
strip.setPixelColor(i, pixel);
9468
}
69+
strip.show();
70+
delay(200);
9571
}
96-
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#FirebaseNeoPixel
2+
3+
FirebaseNeoPixel is a sample that shows how to set pixel data from Firebase web app.
4+
5+
##Hardware setup
6+
7+
1. Get a[Feather Huzzah](https://www.adafruit.com/product/2821)
8+
1. Get a[FeatherWing NeoPixel](https://www.adafruit.com/product/2945)
9+
1. Cut the default jumper and[solder](https://learn.adafruit.com/adafruit-neopixel-featherwing/pinouts) the one forfor`pin13`
10+
1. Solder female headers on the`Feather Huzzah`
11+
1. Solder mail headers on the`FeatherWing NeoPixel`
12+
1. Stack the`FeatherWing NeoPixel` on top of the`Feather Huzzah`
13+
14+
##Software setup
15+
16+
1. Install[Arduino 1.6.9](https://www.arduino.cc/en/Main/Software)
17+
1. Install[Arduino ESP8266 core](https://github.com/esp8266/Arduino#installing-with-boards-manager)
18+
1. Download[FirebaseArduino library](https://github.com/googlesamples/firebase-arduino/archive/master.zip)
19+
1. Start Arduino
20+
1. Click`Sketch > Include Library > Add .ZIP Library...`
21+
1. Choose`firebase-arduino-master.zip` downloaded in step`3.`
22+
1. Install the following libraries using`Sketch > Include Library > Manage Libraries...`:
23+
-[Adafruit_NeoPixel](https://github.com/adafruit/Adafruit_NeoPixel)
24+
25+
##Configuration
26+
27+
1. Go tohttps://www.firebase.com/ and create a new Firebase
28+
1. Copy the`Firebase Hostname`
29+
1. Go to`Secrets`
30+
1. Click`Firebase Secrets > Show`
31+
1. Copy the`Firebase Secret`
32+
1. Start Arduino
33+
1. Click`File > Examples > FirebaseArduino > FirebaseRoom_ESP8266`
34+
1. Replace`WIFI_SSID` and`WIFI_PASSWORD` with WiFi credentials
35+
1. Replace`FIREBASE_HOST` with the`Firebase Hostname` from step`2.`
36+
1. Replace`FIREBASE_AUTH` with`Firebase Secret` from step`5.`
37+
1. Select the board`Board > ESP8266 Modules > NodeMCU 1.0`
38+
1. Select the serial port`Port > /dev/tty...`
39+
1. Select the upload speed`Upload Speed > 115200`
40+
1. Click`Sketch > Upload`
41+
1. Open`public/index.html` with a text editor
42+
1. Replace`example.firebaseio.com` with the`Firebase Hostname` from step`2.`
43+
1. Replace`secret_or_token` with`Firebase Secret` from step`5.`
44+
1. Deploy the`public` directory to Firebase hosting
45+
```
46+
npm install -g firebase-tools bower
47+
(cd public && bower install)
48+
firebase login
49+
firebase init
50+
firebase deploy
51+
```
52+
53+
##Play
54+
55+
1. Go to the firebase hosting URL:`firebase-name.firebaseapp.com`
56+
1. Use the color picker and paint the NeoPixel table
57+
1. Watch the NeoPixel being updated to the matching color

‎examples/Firebase_ESP8266_LEDs/www/web-demo.htmlrenamed to‎examples/FirebaseNeoPixel_ESP8266/public/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
</head>
2424
<script>
2525
// TODO: Needs security.
26-
varfirebaseUrl='https://YOUR_FIREBASE_URL.firebaseio.com';
27-
varfirebaseSecret='YOUR_FIREBASE_SECRET';
26+
varfirebaseUrl='https://example.firebaseio.com';
27+
varfirebaseSecret=secret_or_token;
2828
</script>
2929
<body>
3030
<h2>Paint Demo</h3>

‎examples/FirebaseStream_ESP8266/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ https://publicdata-cryptocurrency.firebaseio.com.
1010

1111
1. Get a[Feather Huzzah](https://www.adafruit.com/product/2821)
1212
1. Get a[FeatherWing OLED](https://www.adafruit.com/products/2900)
13-
1. Solder female headers on the`Feather Huzzah`.
14-
1. Solder mail headers on the`FeatherWing OLED`.
15-
1. Stack the`FeatherWing OLED` on top of the`Feather Huzzah`.
13+
1. Solder female headers on the`Feather Huzzah`
14+
1. Solder mail headers on the`FeatherWing OLED`
15+
1. Stack the`FeatherWing OLED` on top of the`Feather Huzzah`
1616

1717
##Software setup
1818

@@ -36,4 +36,4 @@ https://publicdata-cryptocurrency.firebaseio.com.
3636
##Play
3737

3838
1. Watch the screen be updated with the current bitcoin price.
39-
1. Watch the data being modified as the sketch run.
39+
1. Watch the data being modified as the sketch run

‎examples/Firebase_ESP8266_LEDs/Firebase_ESP8266_Neopixel/colors_ext.h

Lines changed: 0 additions & 93 deletions
This file was deleted.

‎examples/Firebase_ESP8266_LEDs/www/README.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

‎src/FirebaseObject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include"third-party/arduino-json-5.3/include/ArduinoJson.h"
2121

2222
#ifndef FIREBASE_JSONBUFFER_SIZE
23-
#defineFIREBASE_JSONBUFFER_SIZE200
23+
#defineFIREBASE_JSONBUFFER_SIZEJSON_OBJECT_SIZE(32)
2424
#endif// FIREBASE_JSONBUFFER_SIZE
2525

2626
/**

‎test/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ FIREBASE_DIR=..
1818
GTEST_DIR=googletest/googletest
1919
ARDUINOJSON_DIR=../src/third-party/arduino-json-5.3
2020

21-
FIREBASE_SRCS=${FIREBASE_DIR}/src/FirebaseObject.cpp
21+
FIREBASE_SRCS=${FIREBASE_DIR}/src/FirebaseObject.cpp\
22+
${FIREBASE_DIR}/src/FirebaseObject.h
2223
GTEST_SRCS=${GTEST_DIR}/src/gtest-all.cpp
2324
ARDUINOJSON_SRCS=${ARDUINOJSON_DIR}/src/JsonBuffer.cpp\
2425
${ARDUINOJSON_DIR}/src/JsonObject.cpp\
@@ -39,7 +40,7 @@ SRCS=FirebaseArduino_test.cpp\
3940

4041
OBJS=${SRCS:.cpp=.o}
4142

42-
CXXFLAGS=-I../src -Igoogletest/googletest/include -Igoogletest/googletest -std=c++11
43+
CXXFLAGS=-I../src -Igoogletest/googletest/include -Igoogletest/googletest -std=c++11 -g
4344
LDFLAGS=-lpthread
4445

4546
all: check

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp