Hi,
i am very new to arduino and am trying to understand the programming better but i need some quick help…
I have an UNO R3 controlling an air diverter valve via a relay. I repeat actuation 10 times and stop. It works great but i would like to add an indicating led that tells me when my 10 actuations are complete.
I dont know how to add this action. A little guidance would be greatly appreciated.
thank you
Below is my sketch
/*
Relay control with indicator lights
Turns on and off a LED and relay for specified times, Led is on while relay is active. The action is repeated 10 times.
*/
// Pin 11 has an LED connected and pin 12 has a relay.
// give pins names:
int led = 11;
int relay = 12;
void setup()
{
pinMode(led, OUTPUT); //set LED pin as an output
pinMode(relay, OUTPUT); //set relay pin as an output
//do the next thing 10 times
for(int i = 0; i < 10; i += 1)
{
//Turn relay and LED on for X seconds, followed by off for X seconds
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(relay, HIGH); // turn the Relay on (HIGH is the voltage level)
delay(3000); // wait for X seconds
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
digitalWrite(relay, LOW); // turn the Relay off by making the voltage LOW
delay(3000); // wait for X seconds
}
}
void loop(){}