With Instructables you can share what you make with the world, and tap into an ever-growing community of creative experts.
We have a be nice comment policy. Please be positive and constructive.
We noticed you attached photosto your comment.
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)
A simple relay can do this without programming ;(
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.
Wireless upload program to Arduino without USB cable
Program Arduino Pro Mini Using Arduino Uno
How to program Arduino Pro Mini using Arduino Uno and ArduShield - without the cables
Use Arduino Due to program and test ESP8266
Programming Arduino using Raspberry Pi
How to use mBlock software to program the Intelligent Corridor light circuit based on A…
Arduino UNO As AtMega328P Programmer
How to program ATtiny85 with Arduino UNO
Program an ATtiny with Arduino
Program ATmega 328 using arduino (Arduino as ISP)
Posted:Mar 22, 2017
Let your inbox help you discover our best projects, classes, and contests. Instructables will help you learn how to make anything!
© 2016 Autodesk, Inc.