Go Down

Topic: control servo with conditional if (Read 557 times) previous topic - next topic


please give me the script to control servo with conditional if and stop the servo and make it on again if get the next condotional if....
like pull of valve open and close valve...

please give me the direction


Can you explain what you have.

There is a mechanical valve ?
And you want to control it with a servo ?

Can you use an electrial valve, and control that with the Arduino ?

Do you have the servo connected ?
You need the Servo library. In the Arduino, import the Servo library.
Can you make the servo to rotate to a certain position ?

Code: [Select]

#include <Servo.h>

Servo myservo;  // create servo object to control a servo
                 // a maximum of eight servo objects can be created

void setup()
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object

void loop()
  if (....)              // for example check a button.
    myservo.write(0);        // for example position 0 for valve 'on'
    myservo.write(180);    // for example position 180 for valve 'off'

Please do reply to this post, so I know that you have read it.

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!

via Egeo 16
Torino, 10131