Hi, hoping for some help as i'm pulling my hair out. I build a single valve controller a while ago and had great results (https://petapixel.com/2016/06/04/build-diy-double-water-drip-system-high-speed-photos/), so i thought why not create a 3 valve controller. Using the same basic setup i have everything connected but when i press the button only 1 valve fires. I'm a absolute dope when it comes to programming does this look ok??
/*
* How to Make a Double Water Drip system
* By
* Ted Kinsman emkpph@rit.edu
* Assistant Professor of Photographic Sciences
* at Rochester Institute of Technology (RIT)
* May 24, 2016
* This is the simplest version of code and circuit to
* make a double water drip.
* The values below are for a drip height of 44cm from bottom of
* valve to surface of water
*/
const int flashPin = 3; // Set flash to pin 3 controls the opto-isolator
const int StartButton = 7; // Set push button to pin 7 this will be an input from a switch
const int DripValve1 = 8; // Set 1st valve to pin 8 connects to a reed switch which
const int DripValve2 = 9; // Set 2nd valve to pin 9
const int DripValve3 = 10; // Set 3rd valve to pin 10
// controls the solenoid valve
int buttonState = HIGH;
int ValveOpen = 500; // Set a delay variable for time (milliseconds) valve is open
int ValvePause1 = 20; // set delay between drips (milliseconds)
int ValvePause2 = 20; // set delay between drips (milliseconds)
int flashDelay = 290; // Set a delay for flash to be triggered: adjust
// this for part of collision you want to photograph
void setup() {
pinMode(flashPin, OUTPUT); // Set pin 3 as an output
pinMode(StartButton, INPUT); // Set pin 7 as an input
pinMode(DripValve1, OUTPUT); // Set pin 8 as an output
pinMode(DripValve2, OUTPUT); // Set pin 9 as an output
pinMode(DripValve3, OUTPUT); // Set pin 10 as an output
}
void loop() {
buttonState = digitalRead(StartButton);
if (buttonState==LOW) { //starts the drips if the button is pressed
digitalWrite(DripValve1, HIGH); // makes the valve open
delay(ValveOpen); //keeps valve open for ValveOpen time (milliseconds)
digitalWrite(DripValve1, LOW); // makes the valve close
delay(ValvePause1); //keeps valve closed for the time between drips
digitalWrite(DripValve2, HIGH); // makes the valve open for second drip
delay(ValveOpen); //keeps valve open for ValveOpen time (milliseconds)
digitalWrite(DripValve2, LOW); // closes the valve
delay(ValvePause2); //keeps valve closed for the time between drips
digitalWrite(DripValve3, HIGH); // makes the valve open for second drip
delay(ValveOpen); //keeps valve open for ValveOpen time (milliseconds)
digitalWrite(DripValve3, LOW); // closes the valve
delay(flashDelay); //wait the flash delay time to trigger flash
digitalWrite(flashPin, HIGH); //trigger the flash
delay(5); //keep flash trigger pin high long enough to trigger flash
digitalWrite(flashPin, LOW); //turn off flash trigger
delay(3000); // keeps the system in a pause mode to avoid false triggers
} else{
digitalWrite(flashPin, LOW); //sets pins low
digitalWrite(DripValve1, LOW); //sets pins low
digitalWrite(DripValve2, LOW); //sets pins low
digitalWrite(DripValve3, LOW); //sets pins low
}
}
