#include <Adafruit_NeoPixel.h>
#include <LiquidCrystal_I2C.h>
Adafruit_NeoPixel a(20, 4, NEO_GRB + NEO_KHZ800);
LiquidCrystal_I2C lcd(0x27, 20, 4);
int ktory = 1;
int kde[] = {4, 8, 12, 16};
bool test1 = true;
void setup() {
Serial.begin(9600);
pinMode(3, INPUT_PULLUP);
pinMode(A0, INPUT);
pinMode(A1, INPUT);
a.begin();
lcd.init();
lcd.backlight();
}
void loop() {
int brightnes;
int jozo = analogRead(A0);
jozo = map(jozo, 0, 1023, 0, 250);
int color = analogRead(A1);
color = map(color, 0, 1023, 0, 2);
lcd.setCursor(0, 0);
lcd.print("delay:");
lcd.println(jozo);
lcd.print(" ");
lcd.setCursor(0, 2);
lcd.print("color:");
lcd.println(color);
lcd.print(" ");
for (int i = 0; i < 20; i++) {
a.setPixelColor(i, brightnes, 0, 0);
a.show();
delay(jozo);
a.setPixelColor(i, 0, 0, 0);
a.show();
if (i == 20)
i = 0;
}
if (digitalRead(3) == LOW && test1 == true && ktory == 1) {
test1 = false;
if (color == 0) {
color = 1;
}
else if (color == 1) {
color = 2;
}
else if (color == 2) {
color = 3;
}
ktory = 2;
Serial.println(ktory);
Serial.println(color);
}
else if (digitalRead(3) == HIGH && test1 == false)
{
test1 = true;
}
else if (digitalRead(3) == LOW && test1 == true && ktory == 2) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("brightnes");
int brightnes = analogRead(A1);
brightnes = map(brightnes, 0, 1023, 0, 255);
lcd.println(brightnes);
lcd.print(" ");
test1 = false;
ktory = 1 ;
}
else if (digitalRead(3) == HIGH && test1 == false)
{
test1 = true;
}
}