#include <Adafruit_NeoPixel.h>
#define LED_PIN 22
#define LED_COUNT 20
#define BRIGHTNESS 255
#define BUTTON_PIN 25
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(BUTTON_PIN, INPUT_PULLUP); //When pressed, change color.
// Serial.println("Hello, ESP32!");
strip.begin();
strip.show();
strip.setBrightness(BRIGHTNESS);
strip.show();
}
void setColorCircle(int r, int g, int b)
{
for(int i=0; i<strip.numPixels(); i++)
{
strip.setPixelColor(i, strip.Color(r, g, b));
strip.show();
delay(100);
}
}
int curR = 255;
int curG = 255;
int curB = 255;
int modes[3][3] = {{255,255,255}, {255, 0, 255}, {255, 255, 0}};
int curMode = 0;
void loop() {
// put your main code here, to run repeatedly:
if(!digitalRead(BUTTON_PIN))
{
curR = modes[curMode][0];
curG = modes[curMode][1];
curB = modes[curMode][2];
curMode = curMode + 1;
if(curMode > 3) //TODO: Get array length.
curMode = 0;
}
setColorCircle(curR, curG, curB);
delay(50); // this speeds up the simulation
}
esp:VIN
esp:GND.2
esp:D13
esp:D12
esp:D14
esp:D27
esp:D26
esp:D25
esp:D33
esp:D32
esp:D35
esp:D34
esp:VN
esp:VP
esp:EN
esp:3V3
esp:GND.1
esp:D15
esp:D2
esp:D4
esp:RX2
esp:TX2
esp:D5
esp:D18
esp:D19
esp:D21
esp:RX0
esp:TX0
esp:D22
esp:D23
ring1:GND
ring1:VCC
ring1:DIN
ring1:DOUT
vcc1:VCC
gnd1:GND
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r