-
Notifications
You must be signed in to change notification settings - Fork 3
/
Lamp.ino
60 lines (40 loc) · 1.2 KB
/
Lamp.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#define FASTLED_ALLOW_INTERRUPTS 0
#include <FastLED.h>
#include "FastLED_RGBW.h"
#include "define.h"
#include "OTA.h"
#include "patterns.h"
//#include "provWiFi.h"
#include "web.h"
FASTLED_USING_NAMESPACE
void setup() {
delay( 3000); // 3 second delay for boot recovery, and a moment of silence
//FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS)
// .setCorrection( TypicalLEDStrip );
//FastLED with RGBW
FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(ledsRGB, getRGBWsize(NUM_LEDS));
FastLED.setMaxPowerInVoltsAndMilliamps( 5, MAX_POWER_MILLIAMPS);
FastLED.setBrightness(g_brightness);
setupAudio();
Serial.begin(115200);
//connectToWiFi();
//Just need these 2 lines to enable OTA
ArduinoOTA.setHostname("mylamp");
setupOTA();
//Initialise web server
handleServerRequests();
//testCRGBW();
}
void loop() {
ArduinoOTA.handle();
patterns[patternIndex].pattern();
FastLED.setBrightness(g_brightness);
FastLED.show();
EVERY_N_MILLISECONDS(1000) {
ws.cleanupClients();
g_hueShift += g_hueTempo;
if (g_hueTempo != 0) {
notifyClients("{\"key\":\"hueShift\", \"value\":" + (String)g_hueShift + "}");
}
}
}