Hi
I would need to know if this sketch would work (on arduino uno). Here is how the sketch should work:
The pump turns on and water is pumped into a container.
Once the water reaches the two wires (which act like a switch), the pump turns off.The arduino then continues to monitor the water level (adds water when needed)
Here is the sketch:
int switchPin = 4;// water detecting wires//
int motorPin = 6; //(dc pump motor)//
sketch_aug24a:5: error: function 'void setup()' is initialized like a variable
sketch_aug24a:6: error: expected constructor, destructor, or type conversion before '(' token
sketch_aug24a:7: error: expected declaration before '}' token
The water shorting the two wires will give a very poor contact especially if the water is fresh. So you may want to experiment with that. Also you are using the switch to turn the water pump off. What happens if the switch does not work, say a wire comes loose, and the pump keeps running? Is that better or worse than the pump not coming on when the level is low?
Well there are some issues with unmatched braces and the wrong brackets in a couple of spots. The big question is why would you do that if statement "if (digiotalRead(switchPin) == HIGH)" twice in loop()? Also, are you planning on using a relay to switch the pump on? You can get float switches for level.
If that's all you want it to do, you hardly need a microcontroller - just a pump powered via a float switch.
How will your motor be wired? Presumably you will have a separate power supply for the pump, and a driver circuit of some sort between the Arduino and the pump, but you haven't mentioned anything like that.