This file contains hidden or 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
| """Helpers for reading and writing Philips Hue BLE schedules. | |
| This script grew out of reverse-engineering sessions against the Hue BLE | |
| schedule characteristic. It now supports four protocol flows on the schedule | |
| characteristic: | |
| - create a standard wake or sleep schedule from high-level parameters | |
| - update an existing schedule by resending the full body | |
| - delete a schedule by id | |
| - query and read back stored schedules |
This file contains hidden or 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
| const char* SSID = "YOUR_SSID"; | |
| const char* PWD = "YOUR_PWD"; | |
| void setup(){ | |
| Serial.begin(115200); | |
| preferences.begin("credentials"); | |
| preferences.clear(); | |
| preferences.putString("ssid", SSID); | |
| preferences.putString("pwd", PWD); | |
| Serial.println(preferences.getString("ssid")); |
This file contains hidden or 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 "memory_utils.h" | |
| #include <ArduinoJson.h> | |
| StaticJsonDocument<250> responseJson; | |
| char buffer[250]; | |
| void createJson(String message) { | |
| responseJson.clear(); | |
| responseJson["message"] = message; | |
| serializeJson(responseJson, buffer); |
This file contains hidden or 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 <WiFi.h> | |
| #include <WebServer.h> | |
| const char* SSID = "YOUR_SSID"; | |
| const char* PWD = "YOUR_PASSWORD"; | |
| const String serverHostname = "esp32"; | |
| const int serverPort = 80; | |
| // Set your Static IP address | |
| const IPAddress serverIP(192, 168, 1, 184); | |
| // Set your Gateway IP address |
This file contains hidden or 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 "include/server_utils.h" | |
| void setup(){ | |
| Serial.begin(115200); | |
| // Setup static IP and hostname | |
| Serial.println("Configuring WIFI"); | |
| WiFi.mode(WIFI_STA); | |
| if (!WiFi.config(serverIP, serverGateway, serverSubnet, serverPrimaryDNS, serverSecondaryDNS)) { | |
| Serial.println("STA Failed to configure"); | |
| } |
This file contains hidden or 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 "include/memory_utils.h" | |
| #include "include/morse_utils.h" | |
| #include "include/wifi_utils.h" | |
| const short OUT_PIN = 23; | |
| const short START_END_PIN = 22; | |
| const int uS_TO_mS_FACTOR = 1000; // Conversion factor for micro seconds to milli seconds | |
| RTC_DATA_ATTR int bootCount = 0; // Boot count |
This file contains hidden or 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
| #ifndef _WIFI_SERVER_UTILS_H | |
| #define _WIFI_SERVER_UTILS_H | |
| #include "memory_utils.h" | |
| #include <WiFi.h> | |
| #include <WebServer.h> | |
| #include <ArduinoJson.h> | |
| #include <Preferences.h> | |
| const char* SSID = "YOUR_SSID"; |
This file contains hidden or 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
| #ifndef _WIFI_UTILS_H | |
| #define _WIFI_UTILS_H | |
| #include "memory_utils.h" | |
| #include "server_utils.h" | |
| #include <HTTPClient.h> | |
| #include <ArduinoJson.h> | |
| StaticJsonDocument<250> httpResponseJson; |
This file contains hidden or 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
| #ifndef _MEMORY_UTILS_H | |
| #define _MEMORY_UTILS_H | |
| #include <Preferences.h> | |
| Preferences preferences; | |
| const char* prefNamespace = "message"; | |
| const char* varName = "messagevar"; | |
| String readMessage(const String def){ |
This file contains hidden or 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 "include/morse_utils.h" | |
| const short OUT_PIN = 8; | |
| const short START_END_PIN = 7; | |
| void setup() { | |
| Serial.begin(9600); | |
| pinMode(OUT_PIN, OUTPUT); | |
| pinMode(START_END_PIN, OUTPUT); | |
| digitalWrite(OUT_PIN, LOW); |
NewerOlder