Hello! First post I am completely lost with how I would go about doing this
I have a code that runs a few different solenoids in a sequence.
I'm trying to create a counter that will track how many times a button is pressed, and then another button that will run the loop as many times as the counter says. I'm not sure if that makes sense
There is probably a much quicker and simpler way to make this loop but I'm just learning and the amount of information out there is a little overwhelming lol thank you all for any help. Some examples or tutorials pointing me in the direction of something similar would be great
const int RELAY_1_C = 5;
const int RELAY_1_A = 2;
const int RELAY_1_B = 3;
const int RELAY_1_D = 4;
const int RELAY_1_E = 1;
void setup() {
pinMode(RELAY_1_C, OUTPUT);
pinMode(RELAY_1_A, OUTPUT);
pinMode(RELAY_1_B, OUTPUT);
pinMode(RELAY_1_D, OUTPUT);
pinMode(RELAY_1_E, OUTPUT);
}
void loop() {
digitalWrite(RELAY_1_E, HIGH); //Relay On
delay(300);
digitalWrite(RELAY_1_C, HIGH); //Relay On
delay(200);
digitalWrite(RELAY_1_A, LOW); // Relay Off
digitalWrite(RELAY_1_B, HIGH); //Relay On
delay(400);
digitalWrite(RELAY_1_A, LOW); // Relay Off
digitalWrite(RELAY_1_B, LOW); //Relay Off
delay(150);
digitalWrite(RELAY_1_D, HIGH); //Relay On
delay(105);
digitalWrite(RELAY_1_D, LOW); //Relay Off
delay(100);
digitalWrite(RELAY_1_C, LOW); //Relay Off
delay(100);
digitalWrite(RELAY_1_E, LOW); //Relay Off
delay(100);
digitalWrite(RELAY_1_A, HIGH); // Relay On
digitalWrite(RELAY_1_B, LOW); //Relay Off
delay(250);
}