Servo

Hi thank you for the info
What im trying to do now is to control 2 servo motor that that can manipulate thru cayenne
The button added to my cayenne will give an output of
1 = 90 position turn for the second servo then will turn the first servo also in 90 and when it is
0 = the first servo will return to 0 position then the second servo will also turn to 0 position
Can you help me with these

a simple thing as this can do the thing:

if (message.channel == 5) and (message.value == "1"):
    SetAngle2(90)
    SetAngle(90)

and

if (message.channel == 5) and (message.value == "1"):
    SetAngle(0)
    SetAngle2(0)

If i put the first servo in gpio 13 and the second servo is in gpio 15 btw im using the board mode. How do i set them?

And what i mean after the first servo turns 90 thesecond servo will then turn 90.
And if the second servo goes back to its 0 position the first servo will follow and go back to its 0 position

you can cross check which GPIO pin refers to which board pin on google. the code i gave above does what you asked for. Only you will need to create another function SetAngle2(angle) to control the second servo.

Is this correct? I dont want to destroy my servo so can you please help me correct it

for value = 1 you have to make change to SetAngle() both are same.

Ok thanks is this possible?
If i set the value = 0
SetAngle(0)
SetAngle1(90)

Value = 1
SetAngle(90)
SetAngle1(0)

i dont understand what you are trying.

Im sorry typo graph error

still, i dont understand what you are doing. you can change any servo at any angle at any time you want. what the point asking me?

Im sorry im just trying to achieve that the first servo will turn 90 position after it reaches the 90 position the second servo will then turn to 90 position
After this if i click again the button the second servo will first return to 0 position after it reaches the 0 position the first servo will then turn to its 0 position thats what im trying to achieve

this is what this code does

Thank you so much im just making sure of my codes because i dont want to destroy my servo
Thanks you help me a lot

1 Like

Hi i tried what you had told me but it seems that the servo is confused only one servo turns

what kind of servo are you using. are you powering them both from the raspberry pi?

I had them externally powered

Im using mg996 r

check if you connected them to the right pin