/*Drip2020RGBLED-Ripple-Tank.ino Ted Kinsman emkpph@rit.edu RIT high-speed photography lab April 16, 2020 RIT This code flashes 3 different giant 10W LEDS at the same time when a water drip is made. the results are a multi-colored drip pattern. Here the powerful LEDs are used as a high speed flash. the LEDs can be triggered at once or the code can be modified to make a strobe sequence. */ const int OpenTime = 57; //keep solenoid water valve open to make the correct // drip size - you will want to adjust this for your system. int LEDFlashDelay =270; //time after drips are formed to set off flash //this allows drip to fall to the pan of water int RLED = 4; // pin 4 controls the 10 watt Red LED int GLED = 5; // pin 5 controls the 10 watt Green LED int BLED = 6; // pin 6 controls the 10 watt Blue LED const int buttonPin =2; //push button to start the program const int dripperPin = 8; //reed relay on pin 8 to control water dripper const int cameraPin = 10; //our reed relays to control camera set to bulb int buttonState = 0; const int settleTime = 3000; //time to let water settle in ms (here 3 seconds) int n = 3; //how many water drips to make (can be any number) int rippleDelay = 160; //time between sequential drips to make nice waves void setup() { pinMode (buttonPin, INPUT); //button is an input pinMode (dripperPin,OUTPUT); //dripper is an output pinMode (RLED, OUTPUT); //Red LED is an output pinMode (GLED, OUTPUT); //Green LED is an output pinMode (BLED, OUTPUT); //Blue LED is an output pinMode (cameraPin, OUTPUT); Serial.begin(9600); //opens the serial port to help in debugging } void loop() { buttonState = digitalRead (buttonPin); //read the value of the button if (buttonState == HIGH){ //start the action when the button is pressed for (int i = 0; i < n; i++) { //this line makes a loop to make multiple drips set n value above digitalWrite(dripperPin,HIGH); //opens the water drip valve delay (OpenTime); // keeps valve open to make one nice drip digitalWrite(dripperPin,LOW); //closes the water drip valve Serial.println (n); //this sends counter number to the serial port delay (rippleDelay); //time between multiple drips } digitalWrite (cameraPin, HIGH); //opens camera shutter on bulb delay (LEDFlashDelay); //wait for water waves to get to the right location digitalWrite (GLED, HIGH); //turn on green LED digitalWrite (RLED, HIGH); //turn on red LED digitalWrite (BLED, HIGH); //turn on blue LED delayMicroseconds(200); //keep pins high (LEDs on for 200 micro seconds.) //note the LED cam be driven with a lot more voltage than 12VDC if the pulse is //very short. This gives more light. I sometimes drive these LEDs at 24V DC digitalWrite (BLED, LOW); //turn off blue LED digitalWrite (RLED, LOW); //turn off RED LED digitalWrite (GLED, LOW); //turn off green LED delay (settleTime); //let water waves settle for a time } }