IoT - Modular - Pixels.cpp
Jump to navigation
Jump to search
#includes, Defines, etc...
1 #include "libraries.h"
2 #include "functions.h"
3 #include "Pixels.h"
Pixels_init()
1 void Pixels_init()
2 {
3 char debugTEXT[46];
4
5 debug_SectionTitle("Configuring Pixels");
6
7 pixels.begin();
8 for (int i = 0; i < PixelCount; i++)
9 {
10 SetAPixel(i, BLK);
11 } // strip.clear(); would be better if it worked right!
12
13 pixels.setBrightness(PixelBright);
14 pixels.show();
15
16 sprintf(debugTEXT, "Configured %d Pixels on pin %d", PixelCount, PixelPin);
17 debug_LineOut(debugTEXT);
18 sprintf(debugTEXT, "Brightness: %d", PixelBright);
19 debug_LineOut(debugTEXT);
20 }
SetAPixel()
1 void SetAPixel(int PixelNumber, int Colour[])
2 {
3 // char debugTEXT[46];
4 // Serial.printf(" -> %d, %d\n", PixelNumber, Colour);
5 pixels.setPixelColor(PixelNumber, Colour[0], Colour[1], Colour[2]);
6 pixels.show();
7 #ifdef DEBUG5
8 sprintf(debugTEXT, "Pixel %d Pixel colour: %03d,%03d,%03d", PixelNumber, Colour[0], Colour[1], Colour[2]);
9 debug_LineOut(debugTEXT);
10 #endif
11 }