Author Options:

Hi I want to programm an arduino help? Answered

Hi I want to program the Arduino in order that when the motion trigger activates the dc motor stops is there a way to do it please help I couldn't find any code please help.

4 Replies

seandogue (author)2017-03-22

There are quite a few example programs in the arduino software dev kit. Look for looping routines.

I'm sure that at least one has the required elements present. Pretty much anything that periodically polls a trigger will do for example code. You can then copy the contents to a new file and edit it to tailor to your use.

More advanced examples would involve using interrupts for the trigger input (from your sensor)

Select as Best AnswerUndo Best Answer

Downunder35m (author)2017-03-22

A simple relay can do this without programming ;(

Select as Best AnswerUndo Best Answer

bwrussell (author)2017-03-22

I'm not going to write the code for you but I can give some pointers here and if you send me actual code in a PM I can try to troubleshoot it.

This should be fairly simple. You should be able to find all the code you need by looking at an example using a motion sensor (for any purpose) and a different one controlling a motor (for any purpose). Copy the relevant parts, clean them up for your use, and tie them together. Most likely you might even be able to find someone who has done something very similiar (start a motor when motion is detected for example).

Basically when the motion sensor sends the signal indicating detection then the code simply sends a stop command to the motor.

Select as Best AnswerUndo Best Answer