This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Make sure we've installed all needed libraries. | |
#include <WiFiNINA.h> | |
#include <ArduinoECCX08.h> | |
#include <ArduinoHttpClient.h> | |
#include <ArduinoJson.h> | |
#include "display.h" | |
void setup() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as admin from "firebase-admin"; | |
import * as functions from "firebase-functions"; | |
import { decode, verify } from "jws"; | |
import axios from "axios"; | |
/** Public webapp key. Required by `signInWithCustomToken` REST API. */ | |
const WEBAPP_APIKEY = "XXXXXXXXXXXXXXXX-XXXXXXX-XXXXXXXXXXXXXX"; | |
/** Schema for Firestore `/devices/{deviceId}` documents. */ | |
interface DeviceData { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "config.h" | |
#include "display.h" | |
#include "wifi.h" | |
#include "json.h" | |
#include "firebase_database.h" | |
void setup() | |
{ | |
setupDisplay(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "config.h" | |
#include "display.h" | |
#include "crypto.h" | |
#include "wifi.h" | |
#include "http_client.h" | |
#include "firebase_auth.h" | |
#include "firebase_database.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"rules": { | |
"$deviceId": { | |
".write": "auth.uid != null && auth.token.deviceId === $deviceId" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void blinkLED(int duration) { | |
digitalWrite(LED_BUILTIN, HIGH); | |
delay(duration); | |
digitalWrite(LED_BUILTIN, LOW); | |
delay(100); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void displayStatus(String msg) { | |
displayText(msg); | |
blinkLED(100); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void displayError(String msg) { | |
displayText("Error: " + msg); | |
blinkLED(300); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void displaySuspend(String msg) { | |
displayText("Execution suspended: " + msg); | |
digitalWrite(LED_BUILTIN, HIGH); // Turn on LED. | |
while (true) { | |
// Stop execution. | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "config.h" | |
#include "display.h" | |
#include "wifi.h" | |
void setup() | |
{ | |
setupDisplay(); | |
setupWiFi(); | |
} |
OlderNewer