21const IPAddress ip(4, 20, 6, 9);
22const IPAddress gateway(192, 168, 1, 1);
40 WiFi.begin(ssid, password);
41 WiFi.config(ip, gateway, subnet);
42 while (WiFi.waitForConnectResult() != WL_CONNECTED) {
43 Serial.println(
"Connection Failed! Rebooting...");
48 Serial.print(
"WiFi connected, IP = ");
49 Serial.println(WiFi.localIP());
53 recv_port,
"/EmotiBit/0/EDA",
54 [](
const OscMessage &m) {
59 OscWiFi.subscribe(recv_port,
"/EmotiBit/0/GYRO:X", [](
const OscMessage &m) {
63 OscWiFi.subscribe(recv_port,
"/EmotiBit/0/GYRO:Y", [](
const OscMessage &m) {
67 OscWiFi.subscribe(recv_port,
"/EmotiBit/0/GYRO:Z", [](
const OscMessage &m) {
72 OscWiFi.subscribe(recv_port,
"/EmotiBit/0/PPG:IR", [](
const OscMessage &m) {
73 float reading = m.arg<
float>(0);
74 Serial.println(reading);
81 if (gyroTotal < gyroThreshold && lastIrReading >= reading) {
89 for (
int i = 0; i < 6; i++) {
91 bool firedRipple =
false;
93 for (
int j = 0; j < 30; j++) {
96 15, i, strip0.ColorHSV(hue, 255, 255),
97 float(random(100)) / 100.0 * .2 + .8,
124 if (ArduinoOTA.getCommand() == U_FLASH)
131 Serial.println(
"Start updating " + type);
133 .onEnd([]() { Serial.println(
"\nEnd"); })
134 .onProgress([](
unsigned int progress,
unsigned int total) {
135 Serial.printf(
"Progress: %u%%\r", (progress / (total / 100)));
137 .onError([](ota_error_t error) {
138 Serial.printf(
"Error[%u]: ", error);
139 if (error == OTA_AUTH_ERROR)
140 Serial.println(
"Auth Failed");
141 else if (error == OTA_BEGIN_ERROR)
142 Serial.println(
"Begin Failed");
143 else if (error == OTA_CONNECT_ERROR)
144 Serial.println(
"Connect Failed");
145 else if (error == OTA_RECEIVE_ERROR)
146 Serial.println(
"Receive Failed");
147 else if (error == OTA_END_ERROR)
148 Serial.println(
"End Failed");
153 Serial.println(
"Ready for WiFi OTA updates");
154 Serial.print(
"IP address: ");
155 Serial.println(WiFi.localIP());
float fmap(float x, float in_min, float in_max, float out_min, float out_max)