добавлена библиотека neoPixels

This commit is contained in:
klassents committed 2024-10-14 15:13:04 +07:00
1 parent 978661626c
commit c0a5927145
8 files changed
+890

No files matched your search

@@ -0,0 +1,42 @@
#include <NeoPixel.h>
#define PIN 2
#define NUMPIXELS 8
NeoPixel pixels(NUMPIXELS, PIN);
uint8_t red = 0xff;
uint8_t green = 0x00;
uint8_t blue = 0x00;
uint8_t white = 0x00;
void setup() {
// init pin for led control
pixels.begin();
}
void loop() {
// clear pixels colors
pixels.clear();
// set new color and show it
for(int i=0; i<NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(red, green, blue));
pixels.show();
}
delay(1000);
// update color to set
if (white == 0xff) {
red = 0xff;
green = blue = white = 0x00;
}else if (red == 0xff) {
green = 0xff;
red = blue = 0x00;
}else if (green == 0xff) {
blue = 0xff;
red = green = 0x00;
}else if (blue == 0xff) {
white = 0xff;
red = green = blue = 0xff;
}
}