#include <FastLED.h>
#define NUM_LEDS 30
CRGB leds[NUM_LEDS];
int progg = 0;
int g1 = 19;
int g2 = 18;
bool prvi = true;
void setup() {
// put your setup code here, to run once:
pinMode(g1, INPUT_PULLUP);
pinMode(g2, INPUT_PULLUP);
Serial.begin(115200);
Serial.println("Hello, ESP32!");
FastLED.addLeds<NEOPIXEL, 4>(leds, NUM_LEDS);
}
void loop() {
for (int i = 0; i < progg; i++) {
leds[i] = CRGB::CRGB::LightGrey;
}
FastLED.show();
if (prvi){
leds[progg] = CRGB::Green;
}
else{
leds[progg] = CRGB::Blue;
}
int s1 = digitalRead(g1);
int s2 = digitalRead(g2);
delay(10); // this speeds up the simulation
if (s1 == 0 && progg < NUM_LEDS && prvi) {
Serial.println("1");
prvi = false;
progg += 1;
}
else if (s2 == 0 && progg < NUM_LEDS && !prvi) {
Serial.println("2");
prvi = true;
progg += 1;
}
}