const int NUM_SOLS = 5;
const int SOL_PINS[NUM_SOLS] = {6, 5, 4, 3, 2};
const unsigned long INTERVAL = 2000;
const bool solSeq[][NUM_SOLS] = { // Solenoid 1, 2, 3, 4, 5
{0, 0, 0, 0, 0}, {1, 0, 0, 0, 0}, {0, 1, 0, 0, 0}, {1, 1, 0, 0, 0},
{0, 0, 1, 0, 0}, {1, 0, 1, 0, 0}, {0, 1, 1, 0, 0}, {1, 1, 1, 0, 0},
{0, 0, 0, 1, 0}, {1, 0, 0, 1, 0}, {0, 1, 0, 1, 0}, {1, 1, 0, 1, 0},
{0, 0, 1, 1, 0}, {1, 0, 1, 1, 0}, {0, 1, 1, 1, 0}, {1, 1, 1, 1, 0}
};
int index = 0;
unsigned long lastTime = 0;
void setup() {
Serial.begin(115200);
for (int pin = 0; pin < NUM_SOLS; pin++) {
pinMode(SOL_PINS[pin], OUTPUT);
}
}
void loop() {
if (millis() - lastTime >= INTERVAL) {
lastTime = millis();
Serial.println(index);
for (int pin = 0; pin < NUM_SOLS; pin++) {
digitalWrite(SOL_PINS[pin], solSeq[index][pin]);
}
index++;
if (index >= 16) index = 0;
}
}