How can I make a servo stop when a pin is High?

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
zinc55
 
Posts: 30
Joined: Thu Jan 19, 2012 6:52 pm

How can I make a servo stop when a pin is High?

Post by zinc55 »

I have a servo running in a loop, a PIR sensor, and an LED. The LED will go high/low depending on the PIR sensor. Right now, the motor spins at all times. The LED blinks in coordination with the PIR. Is it possible to make the servo stop when the PIR is activated, then restart when the charge falls back to 0? I've looked over a lot of places and tried a few things but nothing seems to work.

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: How can I make a servo stop when a pin is High?

Post by Franklin97355 »

Start by showing your code so we can see what you have so far. It would also help if you drew up a picture/schematic of your circuit.

User avatar
zinc55
 
Posts: 30
Joined: Thu Jan 19, 2012 6:52 pm

Re: How can I make a servo stop when a pin is High?

Post by zinc55 »

Alright, here's the code http://BANNED.com/JT656Wnw

The wiring is a bit to complex to take a picture of, but everything other than the common of the PIR (pin 2) and the output led (pin 4) is on the breadboard.

User avatar
philba
 
Posts: 387
Joined: Mon Dec 19, 2011 6:59 pm

Re: How can I make a servo stop when a pin is High?

Post by philba »

well, fer starters, you are testing against the value of the variable inputPin - that will always be 2. You seem to be confused between the pin number and the value read from that pin though later you actually read the pin.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”