46 lines
1.0 KiB
C++
46 lines
1.0 KiB
C++
#include <Arduino.h>
|
|
#include "spore/Spore.h"
|
|
#include "spore/util/Logging.h"
|
|
#include "NeoPatternService.h"
|
|
|
|
#ifndef LED_STRIP_PIN
|
|
#define LED_STRIP_PIN 2
|
|
#endif
|
|
|
|
#ifndef LED_STRIP_LENGTH
|
|
#define LED_STRIP_LENGTH 8
|
|
#endif
|
|
|
|
#ifndef LED_STRIP_TYPE
|
|
#define LED_STRIP_TYPE (NEO_GRB + NEO_KHZ800)
|
|
#endif
|
|
|
|
// Create Spore instance with custom labels
|
|
Spore spore({
|
|
{"app", "neopattern"},
|
|
{"device", "light"},
|
|
{"pixels", String(LED_STRIP_LENGTH)},
|
|
{"pin", String(LED_STRIP_PIN)}
|
|
});
|
|
|
|
// Create custom service
|
|
NeoPatternService* neoPatternService = nullptr;
|
|
|
|
void setup() {
|
|
// Initialize the Spore framework
|
|
spore.setup();
|
|
|
|
// Create and add custom service
|
|
neoPatternService = new NeoPatternService(spore.getTaskManager(), LED_STRIP_LENGTH, LED_STRIP_PIN, LED_STRIP_TYPE);
|
|
spore.addService(neoPatternService);
|
|
|
|
// Start the API server and complete initialization
|
|
spore.begin();
|
|
|
|
LOG_INFO( "Main", "NeoPattern service registered and ready!");
|
|
}
|
|
|
|
void loop() {
|
|
// Run the Spore framework loop
|
|
spore.loop();
|
|
} |