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

Commit f3ae835

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents c68307a + cb13cfd commit f3ae835

File tree

143 files changed

+10698
-144
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+10698
-144
lines changed

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "test/googletest"]
2+
path = test/googletest
3+
url = https://github.com/google/googletest.git
4+
[submodule "test/arduino-mock"]
5+
path = test/arduino-mock
6+
url = https://github.com/ed7coyne/arduino-mock.git

.travis.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
language: c++
2+
cache: ccache
3+
sudo: false
4+
addons:
5+
apt:
6+
sources:
7+
- ubuntu-toolchain-r-test
8+
packages:
9+
- g++-4.8
10+
env:
11+
- ARDUINO_VERSION=1.6.8 ARDUINO_ESP8266_VERSION=2.1.0 LIB_NEOPIXEL_VERSION=v1.0.5 LIB_GFX_VERSION=v1.1.5 LIB_SSD1306_VERSION=1.1.0 ARDUINO_ROOT=${HOME}/arduino-${ARDUINO_VERSION} ARDUINO_ESP8266_ROOT=${ARDUINO_ROOT}/hardware/esp8266com/esp8266 ARDUINO_HOME=${HOME}/Arduino
12+
- ARDUINO_VERSION=1.6.8 ARDUINO_ESP8266_VERSION=2.2.0-rc1 LIB_NEOPIXEL_VERSION=v1.0.5 LIB_GFX_VERSION=v1.1.5 LIB_SSD1306_VERSION=1.1.0 ARDUINO_ROOT=${HOME}/arduino-${ARDUINO_VERSION} ARDUINO_ESP8266_ROOT=${ARDUINO_ROOT}/hardware/esp8266com/esp8266 ARDUINO_HOME=${HOME}/Arduino
13+
- ARDUINO_VERSION=nightly ARDUINO_ESP8266_VERSION=master LIB_NEOPIXEL_VERSION=master LIB_GFX_VERSION=master LIB_SSD1306_VERSION=master ARDUINO_ROOT=${HOME}/arduino-${ARDUINO_VERSION} ARDUINO_ESP8266_ROOT=${ARDUINO_ROOT}/hardware/esp8266com/esp8266 ARDUINO_HOME=${HOME}/Arduino
14+
install:
15+
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
16+
- ( cd ${HOME} && wget https://downloads.arduino.cc/arduino-${ARDUINO_VERSION}-linux64.tar.xz && tar xf arduino-${ARDUINO_VERSION}-linux64.tar.xz )
17+
- ( LIB=SoftwareSerial VERSION=097712eb07f5b3a70ef419b6e7a7ed2ada5aab85 && cd ${HOME} && wget https://github.com/plerup/espsoftwareserial/archive/${VERSION}.zip -q -O ${LIB}.zip && unzip -q ${LIB}.zip && rm ${LIB}.zip && mv espsoftwareserial-* ${LIB} )
18+
- ( LIB=Adafruit_NeoPixel VERSION=${LIB_NEOPIXEL_VERSION} && cd ${HOME} && wget https://github.com/adafruit/${LIB}/archive/${VERSION}.zip -q -O ${LIB}.zip && unzip -q ${LIB}.zip && rm ${LIB}.zip && mv ${LIB}-* ${LIB} )
19+
- ( LIB=Adafruit-GFX-Library VERSION=${LIB_GFX_VERSION} && cd ${HOME} && wget https://github.com/adafruit/${LIB}/archive/${VERSION}.zip -q -O ${LIB}.zip && unzip -q ${LIB}.zip && rm ${LIB}.zip && mv ${LIB}-* ${LIB} )
20+
- ( LIB=Adafruit_SSD1306 VERSION=${LIB_SSD1306_VERSION} && cd ${HOME} && wget https://github.com/adafruit/${LIB}/archive/${VERSION}.zip -q -O ${LIB}.zip && unzip -q ${LIB}.zip && rm ${LIB}.zip && mv ${LIB}-* ${LIB} )
21+
- git clone --branch ${ARDUINO_ESP8266_VERSION} https://github.com/esp8266/Arduino.git ${ARDUINO_ESP8266_ROOT}
22+
- git submodule init && git submodule update
23+
- ( cd ${ARDUINO_ESP8266_ROOT}/tools && python get.py )
24+
before_script:
25+
- mkdir -p ${ARDUINO_HOME}/libraries
26+
- ( cd ${ARDUINO_HOME}/libraries && ln -s ${TRAVIS_BUILD_DIR} firebase-arduino && ln -s ${TRAVIS_BUILD_DIR}/src/third-party/arduino-json-5.2 ArduinoJson && ln -s ${HOME}/SoftwareSerial ./ && ln -s ${HOME}/Adafruit_NeoPixel ./ && ln -s ${HOME}/Adafruit-GFX-Library ./ && ln -s ${HOME}/Adafruit_SSD1306 ./)
27+
script:
28+
- ${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
29+
- ${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
31+
- ${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
32+
- ( cd test && make check )
33+
- ( cd test/modem/ && make test )

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ This sample shows how to call [Firebase](https://www.firebase.com/) from the [ES
77
## Requirements
88

99
- 1 [ESP8266 Arduino board](https://www.adafruit.com/products/2821).
10-
- [Arduino 1.6.x](https://www.arduino.cc/en/Main/Software)
11-
- ESP8266 Arduino board definition [(master branch)](https://github.com/esp8266/Arduino#using-git-version-)
10+
- [Arduino 1.6.7](https://www.arduino.cc/en/Main/Software)
11+
- [ESP8266 Arduino board definition](https://github.com/esp8266/Arduino#installing-with-boards-manager)
1212

1313
## Setup
1414

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
//
2+
// Copyright 2015 Google Inc.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
//
16+
17+
// FirebaseDemo_ESP8266 is a sample that demo the different functions
18+
// of the FirebaseArduino API.
19+
20+
#include <ESP8266WiFi.h>
21+
#include <FirebaseArduino.h>
22+
23+
void setup() {
24+
Serial.begin(9600);
25+
26+
// connect to wifi.
27+
WiFi.begin("SSID", "PASSWORD");
28+
Serial.print("connecting");
29+
while (WiFi.status() != WL_CONNECTED) {
30+
Serial.print(".");
31+
delay(500);
32+
}
33+
Serial.println();
34+
Serial.print("connected: ");
35+
Serial.println(WiFi.localIP());
36+
37+
Firebase.begin("example.firebaseio.com", "token_or_secret");
38+
}
39+
40+
int n = 0;
41+
42+
void loop() {
43+
// set value
44+
Firebase.set("number", 42.0);
45+
// handle error
46+
if (Firebase.failed()) {
47+
Serial.print("setting /number failed:");
48+
Serial.println(Firebase.error());
49+
return;
50+
}
51+
delay(1000);
52+
53+
// update value
54+
Firebase.set("number", 43.0);
55+
delay(1000);
56+
57+
// get value
58+
Serial.print("number: ");
59+
Serial.println((float)Firebase.get("number"));
60+
delay(1000);
61+
62+
// remove value
63+
Firebase.remove("number");
64+
delay(1000);
65+
66+
// set string value
67+
Firebase.set("message", "hello world");
68+
delay(1000);
69+
// set bool value
70+
Firebase.set("truth", false);
71+
delay(1000);
72+
73+
// append a new value to /logs
74+
String name = Firebase.push("logs", n++);
75+
Serial.print("pushed: /logs/");
76+
Serial.println(name);
77+
delay(1000);
78+
}

examples/FirebasePush_ESP8266/FirebasePush_ESP8266.ino

Lines changed: 0 additions & 63 deletions
This file was deleted.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
//
2+
// Copyright 2015 Google Inc.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
//
16+
17+
18+
// A sample that will start our serial transciever listening on a software
19+
// port and allow debug over the main serial port.
20+
//
21+
// A suggested setup for testing this example would be a USB to TTL cable
22+
// with the green wire connected to pin 5 and the white wire connected to
23+
// pin 4 (on the huzzah feather esp8266).
24+
// First edit begin.txt and put in your host and secret.
25+
// Then run the following commands to setup the serial port in linux:
26+
// stty -F /dev/ttyUSB0 9600 raw -echo -echoe -echok
27+
// Then on one console do:
28+
// cat /dev/ttyUSB0 &
29+
// This console will now read all responses from the modem. Then do:
30+
// cat begin.txt > /dev/ttyUSB0
31+
// You should see +OK and you can now feed in the other example commmands.
32+
33+
#include <SoftwareSerial.h>
34+
#include <ESP8266WiFi.h>
35+
36+
#include <Firebase.h>
37+
#include <SerialTransceiver.h>
38+
39+
SoftwareSerial data_serial(5 /*RX*/, 4/*TX*/);
40+
firebase::modem::SerialTransceiver transceiver;
41+
42+
void setup() {
43+
Serial.begin(9600);
44+
45+
// connect to wifi.
46+
WiFi.begin("SSID", "PASSWORD");
47+
Serial.print("connecting");
48+
while (WiFi.status() != WL_CONNECTED) {
49+
Serial.print(".");
50+
delay(500);
51+
}
52+
Serial.println();
53+
Serial.print("connected: ");
54+
Serial.println(WiFi.localIP());
55+
56+
data_serial.begin(9600);
57+
while (!data_serial) {
58+
Serial.println("Error initilizing serial.");
59+
delay(5000);
60+
}
61+
62+
transceiver.begin(&data_serial);
63+
}
64+
65+
void loop() {
66+
transceiver.loop();
67+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BEGIN $YOUR_HOST $YOUR_SECRET
2+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BEGIN_STREAM /serial/test
2+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
END_STREAM
2+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
GET /serial/test
2+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GET /serial/push_test
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PUSH /seria/push_test "this is a test string \ "
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
REMOVE /serial/test
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SET /serial/test this is a test string \ "
2+

examples/FirebaseStream_ESP8266/FirebaseStream_ESP8266.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
// public Firebase and optionally display them on a OLED i2c screen.
1919

2020
#include <Firebase.h>
21+
#include <ESP8266WiFi.h>
2122
#include <Adafruit_GFX.h>
2223
#include <Adafruit_SSD1306.h>
23-
#include <ArduinoJson.h>
2424

25-
#define OLED_RESET 10
25+
#define OLED_RESET 3
2626
Adafruit_SSD1306 display(OLED_RESET);
2727

2828
Firebase fbase("publicdata-cryptocurrency.firebaseio.com");
@@ -44,7 +44,7 @@ void setup() {
4444
Serial.println();
4545
Serial.print("connected: ");
4646
Serial.println(WiFi.localIP());
47-
stream = fbase.stream("/bitcoin");
47+
stream = fbase.stream("/bitcoin/last");
4848
}
4949

5050

@@ -65,8 +65,8 @@ void loop() {
6565
Serial.println(event);
6666
JsonObject& json = buf.parseObject((char*)event.c_str());
6767
String path = json["path"];
68-
float data = json["data"];
69-
68+
float data = json["data"];
69+
7070
// TODO(proppy): parse JSON object.
7171
display.clearDisplay();
7272
display.setTextSize(2);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_STORE

0 commit comments

Comments
 (0)