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

Commit dfe96c0

Browse files
committed
Merge branch 'neofixel' of https://github.com/gguuss/firebase-arduino into neofixel
2 parents f3ae835 + ebb04ee commit dfe96c0

File tree

207 files changed

+13561
-10582
lines changed

Some content is hidden

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

207 files changed

+13561
-10582
lines changed

.travis.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ addons:
88
packages:
99
- g++-4.8
1010
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
11+
- ARDUINO_VERSION=1.6.9 ARDUINO_ESP8266_VERSION=2.3.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
1312
- 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
1413
install:
1514
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
@@ -23,11 +22,13 @@ install:
2322
- ( cd ${ARDUINO_ESP8266_ROOT}/tools && python get.py )
2423
before_script:
2524
- 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 ./)
25+
- ( cd ${ARDUINO_HOME}/libraries && ln -s ${TRAVIS_BUILD_DIR} firebase-arduino && ln -s ${TRAVIS_BUILD_DIR}/src/third-party/arduino-json-5.6.7 ArduinoJson && ln -s ${HOME}/SoftwareSerial ./ && ln -s ${HOME}/Adafruit_NeoPixel ./ && ln -s ${HOME}/Adafruit-GFX-Library ./ && ln -s ${HOME}/Adafruit_SSD1306 ./)
2726
script:
2827
- ${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
2928
- ${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
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/FirebaseNeoPixel_ESP8266/FirebaseNeoPixel_ESP8266.ino
3130
- ${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
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/FirebaseRoom_ESP8266/FirebaseRoom_ESP8266.ino
3232
- ( cd test && make check )
3333
- ( cd test/modem/ && make test )
34+
- test/travis/check_all_examples_use_standard_init.sh

README.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
1-
# firebase-arduino
1+
# FirebaseArduino
22

3+
[![Build Status](https://travis-ci.org/googlesamples/firebase-arduino.svg?branch=master)](https://travis-ci.org/googlesamples/firebase-arduino)
34
[![Join the chat at https://gitter.im/googlesamples/firebase-arduino](https://badges.gitter.im/googlesamples/firebase-arduino.svg)](https://gitter.im/googlesamples/firebase-arduino?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5+
[![Documentation Status](https://readthedocs.org/projects/firebase-arduino/badge/?version=latest)](http://firebase-arduino.readthedocs.io/en/latest/?badge=latest)
46

5-
This sample shows how to call [Firebase](https://www.firebase.com/) from the [ESP8266 Arduino core](https://github.com/esp8266/Arduino).
7+
This repo contains a collection of samples and an Arduino library that show how to call the [Firebase](https://www.firebase.com/) API from the [ESP8266 Arduino core](https://github.com/esp8266/Arduino).
68

7-
## Requirements
9+
The Arduino library is [under heavy development](https://github.com/googlesamples/firebase-arduino/issues), **experimental**, **unversioned** and its API is **not stable**.
810

9-
- 1 [ESP8266 Arduino board](https://www.adafruit.com/products/2821).
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)
11+
## Samples
1212

13-
## Setup
13+
- [FirebaseDemo](https://github.com/googlesamples/firebase-arduino/tree/master/examples/FirebaseDemo_ESP8266) - shows the FirebaseArduino API methods.
14+
- [FirebaseRoom](https://github.com/googlesamples/firebase-arduino/tree/master/examples/FirebaseRoom_ESP8266) - shows how to push sensor data and trigger actuator from Firebase.
15+
- [FirebaseStream](https://github.com/googlesamples/firebase-arduino/tree/master/examples/FirebaseStream_ESP8266) - shows the FirebaseArduino streaming API.
16+
- [FirebaseNeoPixel](https://github.com/googlesamples/firebase-arduino/tree/master/examples/FirebaseNeoPixel_ESP8266) - shows how to control an array of LEDs from a Firebase web app.
1417

15-
- Clone the repo in your Arduino libraries directory.
16-
- open the `FirebasePush_ESP8266` example.
17-
- Replace `SSID` `PASSWORD` `example.firebaseio.com` `secret_or_token` `child_node` placeholders.
18+
## Documentation
1819

19-
## Run
20+
- [FirebaseArduino API Reference](http://firebase-arduino.readthedocs.io/)
2021

21-
- Open firebase dashboard.
22-
- Power up the arduino board.
23-
- Notice the new entry.
22+
## Disclaimer
2423

2524
*This is not an official Google product*.

README.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FirebaseArduino is a library to simplify connecting to the Firebase database from
2+
arduino clients.
3+
4+
It is a full abstraction of Firebase's REST API exposed through C++ calls in a wiring
5+
friendly way. All Json parsing is handled by the library and you may deal in pure C/Arduino
6+
types.
7+
8+
----------------------------------

docs/read_the_docs/Doxyfile

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
DOXYFILE_ENCODING = UTF-8
2+
PROJECT_NAME = firebase-arduino
3+
PROJECT_NUMBER =
4+
PROJECT_BRIEF =
5+
PROJECT_LOGO =
6+
OUTPUT_DIRECTORY = .
7+
CREATE_SUBDIRS = NO
8+
ALLOW_UNICODE_NAMES = NO
9+
OUTPUT_LANGUAGE = English
10+
BRIEF_MEMBER_DESC = YES
11+
REPEAT_BRIEF = YES
12+
ABBREVIATE_BRIEF = "The $name class" "The $name widget" "The $name file" is provides specifies contains represents a an the
13+
ALWAYS_DETAILED_SEC = NO
14+
INLINE_INHERITED_MEMB = NO
15+
FULL_PATH_NAMES = YES
16+
SHORT_NAMES = NO
17+
JAVADOC_AUTOBRIEF = YES
18+
QT_AUTOBRIEF = NO
19+
MULTILINE_CPP_IS_BRIEF = NO
20+
INHERIT_DOCS = YES
21+
SEPARATE_MEMBER_PAGES = NO
22+
TAB_SIZE = 4
23+
OPTIMIZE_OUTPUT_FOR_C = NO
24+
OPTIMIZE_OUTPUT_JAVA = NO
25+
OPTIMIZE_FOR_FORTRAN = NO
26+
OPTIMIZE_OUTPUT_VHDL = NO
27+
MARKDOWN_SUPPORT = YES
28+
AUTOLINK_SUPPORT = YES
29+
BUILTIN_STL_SUPPORT = NO
30+
CPP_CLI_SUPPORT = NO
31+
SIP_SUPPORT = NO
32+
IDL_PROPERTY_SUPPORT = YES
33+
DISTRIBUTE_GROUP_DOC = NO
34+
SUBGROUPING = YES
35+
INLINE_GROUPED_CLASSES = NO
36+
INLINE_SIMPLE_STRUCTS = NO
37+
TYPEDEF_HIDES_STRUCT = NO
38+
LOOKUP_CACHE_SIZE = 0
39+
EXTRACT_ALL = NO
40+
EXTRACT_PRIVATE = NO
41+
EXTRACT_STATIC = NO
42+
EXTRACT_LOCAL_CLASSES = YES
43+
EXTRACT_LOCAL_METHODS = NO
44+
EXTRACT_ANON_NSPACES = NO
45+
HIDE_UNDOC_MEMBERS = NO
46+
HIDE_UNDOC_CLASSES = NO
47+
HIDE_FRIEND_COMPOUNDS = NO
48+
HIDE_IN_BODY_DOCS = NO
49+
INTERNAL_DOCS = NO
50+
CASE_SENSE_NAMES = NO
51+
HIDE_SCOPE_NAMES = NO
52+
HIDE_COMPOUND_REFERENCE= NO
53+
SHOW_INCLUDE_FILES = YES
54+
SHOW_GROUPED_MEMB_INC = NO
55+
FORCE_LOCAL_INCLUDES = NO
56+
INLINE_INFO = YES
57+
SORT_MEMBER_DOCS = YES
58+
SORT_BRIEF_DOCS = NO
59+
SORT_MEMBERS_CTORS_1ST = NO
60+
SORT_GROUP_NAMES = NO
61+
SORT_BY_SCOPE_NAME = NO
62+
STRICT_PROTO_MATCHING = NO
63+
GENERATE_TODOLIST = YES
64+
GENERATE_TESTLIST = YES
65+
GENERATE_BUGLIST = YES
66+
GENERATE_DEPRECATEDLIST= YES
67+
MAX_INITIALIZER_LINES = 30
68+
SHOW_USED_FILES = YES
69+
SHOW_FILES = YES
70+
SHOW_NAMESPACES = YES
71+
QUIET = NO
72+
WARNINGS = YES
73+
WARN_IF_UNDOCUMENTED = YES
74+
WARN_IF_DOC_ERROR = YES
75+
WARN_NO_PARAMDOC = NO
76+
WARN_FORMAT = "$file:$line: $text"
77+
INPUT = ../../src
78+
INPUT_ENCODING = UTF-8
79+
FILE_PATTERNS = *.c *.cc *.cxx *.cpp *.h *.hxx *.hpp *.h++
80+
RECURSIVE = YES
81+
EXCLUDE_SYMLINKS = NO
82+
EXAMPLE_PATTERNS = *
83+
EXAMPLE_RECURSIVE = NO
84+
FILTER_SOURCE_FILES = NO
85+
SOURCE_BROWSER = NO
86+
INLINE_SOURCES = NO
87+
STRIP_CODE_COMMENTS = YES
88+
REFERENCED_BY_RELATION = NO
89+
REFERENCES_RELATION = NO
90+
REFERENCES_LINK_SOURCE = YES
91+
SOURCE_TOOLTIPS = YES
92+
USE_HTAGS = NO
93+
VERBATIM_HEADERS = YES
94+
CLANG_ASSISTED_PARSING = NO
95+
ALPHABETICAL_INDEX = YES
96+
COLS_IN_ALPHA_INDEX = 5
97+
GENERATE_HTML = NO
98+
HTML_OUTPUT = html
99+
HTML_FILE_EXTENSION = .html
100+
HTML_COLORSTYLE_HUE = 220
101+
HTML_COLORSTYLE_SAT = 100
102+
HTML_COLORSTYLE_GAMMA = 80
103+
HTML_TIMESTAMP = YES
104+
HTML_DYNAMIC_SECTIONS = NO
105+
HTML_INDEX_NUM_ENTRIES = 100
106+
GENERATE_DOCSET = NO
107+
DOCSET_FEEDNAME = "Doxygen generated docs"
108+
DOCSET_BUNDLE_ID = org.doxygen.firebase-arduino
109+
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
110+
DOCSET_PUBLISHER_NAME = Publisher
111+
GENERATE_HTMLHELP = NO
112+
GENERATE_CHI = NO
113+
BINARY_TOC = NO
114+
TOC_EXPAND = NO
115+
GENERATE_QHP = NO
116+
QHP_NAMESPACE = org.doxygen.firebase-arduino
117+
QHP_VIRTUAL_FOLDER = doc
118+
GENERATE_ECLIPSEHELP = NO
119+
ECLIPSE_DOC_ID = org.doxygen.firebase-arduino
120+
DISABLE_INDEX = NO
121+
GENERATE_TREEVIEW = NO
122+
ENUM_VALUES_PER_LINE = 4
123+
TREEVIEW_WIDTH = 250
124+
EXT_LINKS_IN_WINDOW = NO
125+
FORMULA_FONTSIZE = 10
126+
FORMULA_TRANSPARENT = YES
127+
USE_MATHJAX = NO
128+
MATHJAX_FORMAT = HTML-CSS
129+
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
130+
SEARCHENGINE = YES
131+
SERVER_BASED_SEARCH = NO
132+
EXTERNAL_SEARCH = NO
133+
SEARCHDATA_FILE = searchdata.xml
134+
GENERATE_LATEX = NO
135+
LATEX_OUTPUT = latex
136+
LATEX_CMD_NAME = latex
137+
MAKEINDEX_CMD_NAME = makeindex
138+
COMPACT_LATEX = NO
139+
PAPER_TYPE = a4
140+
PDF_HYPERLINKS = YES
141+
USE_PDFLATEX = YES
142+
LATEX_BATCHMODE = NO
143+
LATEX_HIDE_INDICES = NO
144+
LATEX_SOURCE_CODE = NO
145+
LATEX_BIB_STYLE = plain
146+
GENERATE_RTF = NO
147+
RTF_OUTPUT = rtf
148+
COMPACT_RTF = NO
149+
RTF_HYPERLINKS = NO
150+
RTF_SOURCE_CODE = NO
151+
GENERATE_MAN = NO
152+
MAN_OUTPUT = man
153+
MAN_EXTENSION = .3
154+
MAN_LINKS = NO
155+
GENERATE_XML = YES
156+
XML_OUTPUT = xml
157+
XML_PROGRAMLISTING = YES
158+
GENERATE_DOCBOOK = NO
159+
DOCBOOK_OUTPUT = docbook
160+
DOCBOOK_PROGRAMLISTING = NO
161+
GENERATE_AUTOGEN_DEF = NO
162+
GENERATE_PERLMOD = NO
163+
PERLMOD_LATEX = NO
164+
PERLMOD_PRETTY = YES
165+
ENABLE_PREPROCESSING = YES
166+
MACRO_EXPANSION = NO
167+
EXPAND_ONLY_PREDEF = NO
168+
SEARCH_INCLUDES = YES
169+
SKIP_FUNCTION_MACROS = YES
170+
ALLEXTERNALS = NO
171+
EXTERNAL_GROUPS = YES
172+
EXTERNAL_PAGES = YES
173+
PERL_PATH = /usr/bin/perl
174+
CLASS_DIAGRAMS = NO
175+
HIDE_UNDOC_RELATIONS = YES
176+
HAVE_DOT = NO
177+
DOT_NUM_THREADS = 0
178+
DOT_FONTNAME = Helvetica
179+
DOT_FONTSIZE = 10
180+
CLASS_GRAPH = YES
181+
COLLABORATION_GRAPH = YES
182+
GROUP_GRAPHS = YES
183+
UML_LOOK = NO
184+
UML_LIMIT_NUM_FIELDS = 10
185+
TEMPLATE_RELATIONS = NO
186+
INCLUDE_GRAPH = YES
187+
INCLUDED_BY_GRAPH = YES
188+
CALL_GRAPH = NO
189+
CALLER_GRAPH = NO
190+
GRAPHICAL_HIERARCHY = YES
191+
DIRECTORY_GRAPH = YES
192+
DOT_IMAGE_FORMAT = png
193+
INTERACTIVE_SVG = NO
194+
DOT_GRAPH_MAX_NODES = 50
195+
MAX_DOT_GRAPH_DEPTH = 0
196+
DOT_TRANSPARENT = NO
197+
DOT_MULTI_TARGETS = NO
198+
GENERATE_LEGEND = YES
199+
DOT_CLEANUP = YES

docs/read_the_docs/conf.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import sys
2+
import os
3+
import shlex
4+
import subprocess
5+
read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True'
6+
if read_the_docs_build:
7+
subprocess.call('doxygen', shell=True)
8+
extensions = ['breathe']
9+
breathe_projects = { 'firebase-arduino': 'xml' }
10+
breathe_default_project = "firebase-arduino"
11+
templates_path = ['_templates']
12+
source_suffix = '.rst'
13+
master_doc = 'index'
14+
project = u'firebase-arduino'
15+
copyright = u'2015, firebase-arduino'
16+
author = u'firebase-arduino'
17+
version = '1.0'
18+
release = '1.0'
19+
language = None
20+
exclude_patterns = ['_build']
21+
pygments_style = 'sphinx'
22+
todo_include_todos = False
23+
html_static_path = ['_static']
24+
htmlhelp_basename = 'firebase-arduinodoc'
25+
latex_elements = {
26+
}
27+
latex_documents = [
28+
(master_doc, 'firebase-arduino.tex', u'firebase-arduino Documentation',
29+
u'firebase-arduino', 'manual'),
30+
]

docs/read_the_docs/index.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.. toctree::
2+
:maxdepth: 2
3+
.. include:: ../../README.rst
4+
:end-before: ----
5+
Class Documentation
6+
===================
7+
.. doxygenclass:: FirebaseArduino
8+
:project: firebase-arduino
9+
:members:
10+
.. doxygenclass:: FirebaseObject
11+
:project: firebase-arduino
12+
:members:
13+
----
14+
This documentation was built using ArduinoDocs_.
15+
.. _ArduinoDocs: http://arduinodocs.readthedocs.org

docs/read_the_docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
breathe
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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+
// FirebaseCloudMessaging_Send_ESP8266 is a sample that shows sending
18+
// messages to firebase.
19+
20+
#include <ESP8266WiFi.h>
21+
22+
#include <FirebaseCloudMessaging.h>
23+
24+
// Set these to run example.
25+
#define WIFI_SSID "SSID"
26+
#define WIFI_PASSWORD "PASSWORD"
27+
28+
#define SERVER_KEY "key_from_dashboard"
29+
#define CLIENT_REGISTRATION_ID "key_from_client_after_registration"
30+
31+
void setup() {
32+
Serial.begin(9600);
33+
34+
// connect to wifi.
35+
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
36+
Serial.print("connecting");
37+
while (WiFi.status() != WL_CONNECTED) {
38+
Serial.print(".");
39+
delay(500);
40+
}
41+
Serial.println();
42+
Serial.print("connected: ");
43+
Serial.println(WiFi.localIP());
44+
45+
FirebaseCloudMessaging fcm(SERVER_KEY);
46+
FirebaseCloudMessage message =
47+
FirebaseCloudMessage::SimpleNotification("Hello World!", "What's happening?");
48+
FirebaseError error = fcm.SendMessageToUser(CLIENT_REGISTRATION_ID, message);
49+
if (error) {
50+
Serial.print("Error:");
51+
Serial.print(error.code());
52+
Serial.print(" :: ");
53+
Serial.println(error.message().c_str());
54+
} else {
55+
Serial.println("Sent OK!");
56+
}
57+
}
58+
59+
void loop() {
60+
}
61+

0 commit comments

Comments
 (0)