Hi folks,
I'm pretty new to the arduino processor but here goes lol
I'm trying to control water droplets for photography and at the moment I'm using one 5v solid state relay driven by a digital pin to open/close a 24v DC solenoid valve for a specifed time in millseconds then close it and then wait for another specified time before opening the valve to drop a second droplet. The process works well but I want to add more valves to control more droplets
The programme is a simple loop with delays
int ledPin = 7; // relay connected to digital pin 7
int openValve1 = 25; // open time for valve 1
int openValve2 = 25; // open time for valve 2
int delayValve = 80;// time between droplets
int stopflag=0;
// The setup() method runs once, when the sketch starts
void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
}
void loop()
{
while (stopflag!=1){
stopflag=1; // flag set to only cycle through loop once
digitalWrite(ledPin, HIGH); // open valve
delay(openValve1); // wait for openValve delay
digitalWrite(ledPin, LOW); // close valve
delay(delayValve); // wait until second droplet wanted
digitalWrite(ledPin, HIGH); // open valve
delay(openValve2); // wait for openValve delay
digitalWrite(ledPin, LOW); // close valve
}
}
What I would like to do is control at least one more valve but potentially upto 4 and stagger the the timing of each valve so each valve could be operating at slightly differing times, timing accuracy to one millisecond is required. Clearly using the delay() function makes the process sequential. Can someone assist with the programming required to use interupts so each valve is controlled by a different interrupt process similar to the void loop() shown above with each interrupt being started at different times and then running in the background
Sorry if the above doesn't make much sense but it's how I visualise the programme in my head lol
regards
Kev Lewis
http://www.photosbykev.com