running a pump with safety feature


i have a small problem that google or search could not help me with

but i have a pump that needs pulsing dc to work... square wave would be ok, but how do i for example pulse it 3 times a sec?

i could use delay etc but would rather have the pwm do it so i can just change the value if i need to change speed

hiding in case i asked stupid etc

PWM can't be slowed down to three times a second. You could use digitalWrite() to turn the pin off and on to get that low a rate.

It is not clear how that relates to a safety feature, though.

it quite clear... if the on/off spped is not slow enough the pump will simply stop working and shut the flow completely

i will guess that 6 pulses each sec is the max

At that frequency you could just use the 'blink without delay' approach to turn the DC on and off at the required intervals. I'd suggest you don't use delay(), because that would make it hard for your sketch to do anything else.

thanks… i will try and do a search for that, but you are right… its important that the sketch can go on doing other things at the same time

boelle: i will try and do a search for that

'Blink without delay' is one of the standard example sketches that is installed with the IDE.