roll neck

hello guys i use the roll neck with servos not hacked, 

in 1412 i used this script with sucess

def neckMoveTo(restPos,delta):
      leftneckServo.moveTo(restPos + delta)
      rightneckServo.moveTo(restPos - delta)
leftneckServo = Runtime.start("leftNeck","Servo")
rightneckServo = Runtime.start("rightNeck","Servo") 
right = Runtime.start("i01.right", "Arduino")
leftneckServo.attach(right, 13)
rightneckServo.attach(right, 12)
restPos = 90
delta = 20
but now is failing at neckMoveTo :(
can somene help pls

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Mats's picture

connect ?

Hi Pedro

With a quick look if find two problems, if this is the complete script.

1. You have commented out the connect. That's OK if you connect manually thru the GUI or you do it in some other part of the script. I.e this line:


should be


2, If you uncomment the connect, you also need to define a variable so that the script knows what port to connect to. Something like this:

rightPort = 'COM3'

If it's not the complete script, then please send a no-worky




pedro's picture

mats thanks alot for the

mats thanks alot for the help, but is not that is uncommented and the rightPort was defined before :( but it doesnt mather i burn one ot them for some reason wasnt even atached and burned!!! 


so now im using only one and the other as a dummy, so also im not using that script anyway!!


this script used to work, well thanks anyway :)

Mats's picture

Hi Pedro In the latest

Hi Pedro

In the latest release of MyRobotLab you can use the publish subscribe pattern to syncronize servos.

Like this:

# Remap the leftneckServo since it is reversed and 20 degrees offset to the right
# Depending on the direction of the offset you need to remap different,180,200,20)

# Alternative, in case it the offset is in the opposite direction


# Make the left neck servo sync with the right hand servo

Now you only need to send commands to the rightneckServo. The leftneckServo will follow.