Go Down

Topic: Servo and Ping (Read 903 times) previous topic - next topic

aschaef

Hi, I'm new to arduino and am currently working with a ping sensor and servo. I can get the ping to work and the servo to work with a potentiometer separately but am having a hard time getting them to work together. I just want an if statement that when there's an object within a certain distance then the servo moves. Does anyone have a base code for this that I can get started with. I already have know about the ones that come with the software, but anything that combines the two that I can edit to fit my needs.

Thanks so much!

AWOL

Quote
I just want an if statement that when there's an object within a certain distance then the servo moves

Code: [Select]
if (pingRange () < THRESHOLD_DISTANCE) {
  servo.write (POSITION_ONE);
}
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy