#include <ezButton.h>
#define RED 7
#define GREEN 8
#define BLUE 9
#define YELLOW 10
#define PURPLE 11
#define CYAN 12
ezButton button(2);
byte count;
unsigned long released;
byte arrayofpins[6] = {RED,GREEN,BLUE,YELLOW,PURPLE,CYAN};
void setup() {
for (byte x : arrayofpins) pinMode(x, OUTPUT);
button.setDebounceTime(50);
}
void loop() {
button.loop();
if (button.isReleased()) {
count++;
released = millis();
}
if (millis() - released >= 500 && count) {
if (count <= 6)
digitalWrite(arrayofpins[count-1], !digitalRead(arrayofpins[count-1]));
count = 0;
}
}
push button toggle ON/OFF ARRAY
Toggle switch LED:
RED = 1x pressed
GREEN = 2x pressed
BLUE = 3x pressed
YELLOW = 4x pressed
PURPLE = 5x pressed
CYAN = 6x pressed
youtu.be/vNo1GlYzptw