tweaking test code

This commit is contained in:
2020-12-21 17:38:22 -08:00
parent cbfde6b3a4
commit 0dbfc80cf3
3 changed files with 64 additions and 15 deletions

View File

@@ -2,27 +2,41 @@
Adafruit_NeoPixel pixels(1, 11, NEO_GRB + NEO_KHZ800);
auto cRed = pixels.Color(255, 0, 0);
auto cBlue = pixels.Color(0, 0, 255);
void
init()
setup()
{
Serial.begin(115200);
pixels.begin();
pixels.clear();
pixels.show();
}
void
main()
loop()
{
static bool on = false;
Serial.println("blink");
if (on) {
pixels.clear();
for (int i = 10; i < 255; i++) {
auto c = pixels.Color(0, (uint8_t)i, 0);
pixels.setPixelColor(0, c);
pixels.show();
delay(4);
}
on = false;
} else {
pixels.setPixelColor(0, pixels.color(0, 255, 0));
for (int i = 255; i > 9; i--) {
auto c = pixels.Color(0, (uint8_t)i, 0);
pixels.setPixelColor(0, c);
pixels.show();
delay(4);
}
on = true;
}
pixels.show();
delay(1000);
}