8 #include <Adafruit_NeoPixel.h>
14 static const size_t PATTERN_COUNT = 2;
53 m_badge->
display().print(
"The classic\nNeopixel strandtest\napp.\n\n");
54 m_badge->
display().println(
"Long press B to return to app menu.\n");
62 for (
size_t i = 0; i < PATTERN_COUNT; i++)
77 if (!button->isActive())
79 if (button->lastActiveDuration() < 800)
81 if (button->getID() == 1)
83 m_patterns[m_currentPattern]->setBrightness(m_patterns[m_currentPattern]->getBrightness() + 10);
85 if (button->getID() == 2)
87 m_patterns[m_currentPattern]->setBrightness(m_patterns[m_currentPattern]->getBrightness() - 10);
89 if (button->getID() == 0)
91 m_patterns[m_currentPattern]->setBrightness(m_patterns[m_currentPattern]->getBrightness() - 1);
93 if (button->getID() == 3)
95 m_patterns[m_currentPattern]->setBrightness(m_patterns[m_currentPattern]->getBrightness() + 1);
100 if (button->getID() == 1)
104 if (button->getID() == 2)
108 m_currentPattern = m_currentPattern >= PATTERN_COUNT
110 : m_currentPattern = m_currentPattern < 0 ? 0 : m_currentPattern;
122 m_patterns[m_currentPattern]->run();
137 int m_currentPattern = 0;
char * m_name
Name of application.
Definition: App.h:132
Definition: RainbowCycle.h:8
Definition: RainbowChase.h:8
bool handleButton(IButton *button)
Definition: NeoTestApp.h:72
Adafruit_ILI9341 & display()
Gets the TFT display driver.
Definition: Dilbert.h:44
void onExit()
Definition: NeoTestApp.h:128
virtual void onEntry()
Called when the application is entered.
Definition: App.h:70
Definition: NPPattern.h:6
virtual bool handleButton(IButton *button)
Handle button presses.
Definition: App.h:121
virtual void onExit()
Called when the application exits.
Definition: App.h:101
App(char *name)
Creates a new instance of a badge application.
Definition: App.h:22
void run()
Definition: NeoTestApp.h:120
void onEntry()
Definition: NeoTestApp.h:39
void destroy()
Definition: NeoTestApp.h:60
void create()
Definition: NeoTestApp.h:29
Adafruit_NeoPixel & neoPixels()
Gets the NeoPixel LED driver.
Definition: Dilbert.h:67
Dilbert * m_badge
Pointer to badge driver.
Definition: App.h:129
Definition: NeoTestApp.h:11
Used to encapsulate an individual application.
Definition: App.h:15