I'm trying to make a water pump work with arduino but I have a problem, it doesn't work and I don't know why. I'm a beginner with arduino so there are a lot of thing that I don't know.
I'm using a relay and a external energy suply, a battery, because I know that the arduino cannot do it by itself.
The conections in the relay are:
INPUTS
- DC+: positive power supply (VCC)
- DC-: negative power supply (GND)
- IN: Digital 9
OUTPUTS
- COM: Battery +
- NC: Water pump
And finnaly I have the water pump connected to the Battery - and to the relay (NC).
The code I'm using is this:
const int control = 9 ;
void setup()
{
pinMode(control, OUTPUT) ;
}
void loop()
{
digitalWrite(control, HIGH);
delay(2000);
digitalWrite(control, LOW);
delay(1000);
}
Can anybody help me please? I'm in a hurry and I don't know what else to do.
Thanks beforehand.