Go Down

Topic: Need help with controlling servo with Sharp distance sensor. (Read 397 times) previous topic - next topic

RIFarfa27

Here, I have arduino uno, micro servo, and a distance sensor. I connect the servo on pin 9 and the sensor on analog pin 0 (A0). I want to rotate the servo to 90 degrees when the distance sensor detecting. and if it does not detect the remains in a position of 0 degrees. how about source code ? please help me.

CrossRoads

Try reading  here to start, see how things are done.
http://forum.arduino.cc/index.php?topic=185476.0
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

RIFarfa27

I've tried the code. Servo keep rotate but sensor not detect'. :\

tylernt


I've tried the code. Servo keep rotate but sensor not detect'. :\
If you post your code here on this forum, perhaps we can help.

Go Up