Thanks for the blunt reply PaulS
I did say "Personally, I feel...". If you feel otherwise, I have no problem with that. If I offended you, I apologize.
Following this : http://www.arduino.cc/en/Tutorial/button button state will be HIGH if pressed. Or am I wrong?
You are right. But, that requires an external resistor and more wiring. There are internal pullup resistors in the Arduino. Make use of them, and the wiring gets a lot simpler - one wire from the switch to the pin and one wire from the switch to ground. Then, LOW means pressed.
I changed the code accordingly. Hope it looks better now?
I don't like the name, still, but that's OK. As long as the name means something to you, stick with it.
That will stick in the back of my mind from now on
There is a reminder right on the board. 8)
The precise number will be determined once the hardware is up and running and the flow through the solenoid can be determined.
That's fine. If, and it's a big if, the solenoid opens and closes in a consistent amount of time, and that every time the there is the same delay between triggering the solenoid and turning it off, the exact same amount of material is dispensed.
For things like washing machines dispensing soap, a minor (or even significant) variation is acceptable. If you are dispensing medicine, it is not.
delay(delayTime); //keep relay activated long enough to dispense certain volume
If you are, as you hinted, going to be having the Arduino do other things, delay() is not a good idea. Look at the blink without delay example to see how to avoid it.
The name, delayTime, is not particularly good, either. Since the purpose of the delay is to dispense material, I'd use a name like dispenseTime.