I found a very useful video on Youtube showing how to use ring/pipe clamps to trigger the shut off with a solenoid.
I have a few projects in mind, adapting this, to automatically fill the dogs water bucket, and to also trigger pumps to turn on and off when I experience flooding in my garage.
When I examined the sorce code to this project, I couldn't work out what exactly a part of the code was doing. Can some explain to me what the code is doing in relation to the water sensor (ring clamp).
YouTube Video
His website with project details (with link to source code)
https://makingstuff.info/Projects/Water_Valve
Code extract
for(int x = 0; x < 8 ; x++)
{
avgWater += analogRead(waterSensor);
}
avgWater /= 8;
Question 1: How does the x<8 operate in the loop?
Question 2: How does the += operate in the loop?
Question 3: How does the /= operate in the loop?
Thanks in advance.