-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnodemcu_neopixel_mqtt.ino
49 lines (36 loc) · 962 Bytes
/
nodemcu_neopixel_mqtt.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
#include <ArduinoJson.h>
#include "./src/Kernel/Kernel.h"
#include "./src/Interface/IModule.h"
#include "./src/Module/LedStripModule/LedStripModule.h"
#include "./src/Module/LedStripModule/Enum/LightType.h"
#define DEVICE_ID "15ledstrip"
#define LED_PIN 5
#define LED_COUNT 15
Kernel *kernel;
LedStripModule *led;
void onConfigurationRecieved(JsonObject configuration)
{
Serial.println("CONFIG");
led->applyPreset(Solid, configuration);
}
void onActionTriggered(JsonObject configuration)
{
Serial.println("ACTION");
}
void setup()
{
// char *deviceId = (char *)malloc(sizeof(char) * (strlen(DEVICE_ID) + 1));
// deviceId = (char *)DEVICE_ID;
led = new LedStripModule(DEVICE_ID, LED_PIN, LED_COUNT);
Serial.begin(115200);
delay(1000);
led->applyPreset(Solid, true);
// Serial.begin(115200);
// delay(1000);
kernel = new Kernel(led, onConfigurationRecieved, onActionTriggered);
}
void loop()
{
kernel->loop();
delay(10);
}