All Tutorials / Steve G / Setting Servo speeds and Initialization Script Tutorial

Setting Servo speeds and Initialization Script Tutorial

Step 3. Servo Speed Init with Multiple Boards

You may have multiple EZ-B's connected to your EZ Builder project, with servos connected to each board. In this case, some slight changes need to made to the servo speed and position "Init" script. To use an example, we will say that we have two EZ-B's connected to "Board 0" and "Board 2" in one EZ Builder project.

1.) Follow one of the previous steps to create an "Init" script, and open it's script editor.

2.) For servos connected to "Board 0", no change in the original "Init" script is needed.

3.) Any script lines that are controlling servos connected to "Board 2" will need to be started with a 2. (a number two and a period), so the script should look something like this...

Code:

 #Servo speed initialization.

# Servos connected to board 0.
ServoSpeed(D1, 0)
ServoSpeed(D2, 0)
ServoSpeed(D3, 0)

# Servos connected to board 2.
ServoSpeed(2.D4, 0)
ServoSpeed(2.D5, 0)
ServoSpeed(2.D6, 0)
ServoSpeed(2.D7, 0)


# Desired starting positions.

# Servos connected to board 0.
Servo(D1, 90)
Servo(D2, 40)
Servo(D3, 90)

# Servos connected to board 2.
Servo(2.D4, 90)
Servo(2.D5, 38)
Servo(2.D6, 82)
Servo(2.D7, 40)


# Newly set servo speeds

# Servos connected to board 0.
ServoSpeed(D1, 2)
ServoSpeed(D2, 3)
ServoSpeed(D3, 1)

# Servos connected to board 2.
ServoSpeed(2.D4, 2)
ServoSpeed(2.D5, 1)
ServoSpeed(2.D6, 3)
ServoSpeed(2.D7, 2)



User-inserted image

In the next step, I will explain further uses for an "Init" script with a couple of examples.