Servo

BlocklyProp reference for SERVO blocks

Block and I/O pin availability varies by board type.

The PIN menu on these blocks can be set to "other."  When "other" is chosen, the dropdown menu disappears, and it is replaced with an input.  You can then use any block that provides a numeric value such as a number value, get variable, or constant value block:


Standard servo

This block launches a processor automatically; using up to 14 servos on different Propeller I/O pins will not launch additional processors.

Use this block with the Parallax Standard Servo (#900-00005) and the Propeller Activity Board WX, Propeller FLiP, S3 Robot, and Other board types. Not available for the Badge board type.

 The standard servo block sends control pulses to position a Parallax Standard Servo.

  1. Set the PIN drop-down to the Propeller I/O pin number connected to the servo's signal pin.
  2. Set the angle for the servo to turn to and hold by inserting a number value in the range of 0 to 180.

Once set, the control pulses will continue until the program encounters another standard servo block or servo disable block for that servo's Propeller I/O pin.


CR servo speed

This block launches a processor automatically, using up to 14 instances of this block will not launch additional processors.

Use this block with the Parallax Continuous Rotation Servo (#900-00008) and the Activity Board WX, Propeller FLiP, and Other board types. Not available for Badge or Scribbler Robot board types.

The CR servo speed block sends control pulses to a servo connected to PIN selected by the drop-down menu that tells the servo what speed in which direction to turn. Negative speeds turn the CR (Continuous Rotation) servo clockwise, and positive speeds turn the servo counter-clockwise. A speed of 0 (zero) stops the CR servo. The speed can be from -200 to 200.  In most cases, you will notice most of the change in speed from -100 to 100.

The CR servo speed block sends pulses to control speed and direction of a Parallax Continuous Rotation servo.

  1. Set the PIN dropdown to the Propeller I/O pin number connected to the servo's signal pin. Pin availability will vary with board type.
  2. Set the speed for the servo to rotate by inserting a number value in the range of -200 to +200, though a change in speed is most noticeable from -100 to +100.
    • Negative numbers turn the servo counter-clockwise
    • positive numbers turn the servo clockwise
    • Zero makes the servo hold still.*

Once set, the control pulses will continue until the program encounters another standard servo block or servo disable block for that servo's Propeller I/O pin.

*If your Parallax CR Servo rotates slowly or buzzes when set to zero, you may need to center it. Very gently, insert a Philips tip screwdriver into the access hole in the servo's case and slightly twist the potentiometer until the servo holds still.


CR servo set ramp

Use this block with the Parallax Continuous Rotation Servo (#900-00008) and the Activity Board WX, Propeller FLiP, and Other board types. Not available for Badge or Scribbler Robot board types.

The CR servo set ramp block sets the maximum amount that the CR servo’s speed connected to the PIN specified in the drop-down menu can be changed each update cycle. A rampstep of 1 means that the servo’s speed can only change 1 unit every 20ms - meaning that its response will be very sluggish. A rampstep between 4 and 8 is a good compromise between responsiveness and protecting the servo from sudden speed changes that can damage the servo.


Feedback 360° servo initialize

This block launches a processor automatically, using up to 4 instances of this block will not launch additional processors.

Use this block with the Parallax Feedback 360° High-Speed Servo (#900-00360) and the Activity Board WX, Propeller FLiP, and Other board types. Not available for Badge or Scribbler Robot board types. 

The Feedback 360° servo initialize block sets up communication between the servo and the Propeller microcontroller. If you forget to use this block in your project, a triangle warning will appear on other Feedback 360° servo blocks as a reminder.

  • Set the PIN dropdown to the Propeller I/O pin connected to the servo's control signal wire — the white wire in the 3-wire cable.
  • Set the FB dropdown to the Propeller I/O pin connected to the servo's feedback signal wire — the single yellow wire.

Feedback 360° servo configure

Use this block with the Parallax Feedback 360° High-Speed Servo (#900-00360) and the Activity Board WX, Propeller FLiP, and Other board types. Not available for Badge or Scribbler Robot board types.

The Feedback360° servo configure (formerly setup) block sets the maximum value for the servo behavior chosen.

  • First, set the PIN dropdown to the Propeller I/O pin number connected to the servo's control or feedback signal line — either one will work.
  • Then, select behavior from the second drop-down.
    1. acceleration (°/s2) determines how quickly the servo will transition to a new speed setting, in units of degrees per second squared.  The valid range is 600 to 7200.
    2. max speed (°/s) determines the maximum rotation speed in units of degrees per second, independent of direction.  The valid range is 1 to 1080.
    3. turn count (+/- revolutions) changes the number of turns that have elapsed since the application has started; use it to reset to zero.
    4. home to position (+/-°) determines the home position's offset from the servo's mechanical 0-degree position. If not configured, the home position is the angle measured when the servo was initialized.
    5. kP for speed determines the proportional constant for the velocity control system. The default value is 500.
    6. kI for speed determines the integral constant for the velocity control system. The default value is 0.
    7. kD for speed determines the derivative constant for the velocity control system. The default value is 0.
    8. I for speed max determines the maximum integral output constant for the velocity control system. The default value is 0.
    9. kP for position determines the proportional constant for the angular control system. The default value is 12000.
    10. kI for position determines the integral constant for the angular control system. The default value is 600
    11. kD for position determines the derivative constant for the angular control system. The default value is 6000
    12. I for position determines the maximum integral output constant for the angular control system. The default value is 1000.
  • Last, insert a value block to configure the chosen behavior. Note that some behavior options have range limits on the value accepted.

Feedback 360° servo set

Use this block with the Parallax Feedback 360° High-Speed Servo (#900-00360) and the Activity Board WX, Propeller FLiP, and Other board types. Not available for Badge or Scribbler Robot board types.

The Feedback360° servo setup block sets the value for the servo behavior chosen.

  • First, set the PIN dropdown to the Propeller I/O pin number connected to the servo's control or feedback signal line — either one will work.
  • Then, select behavior from the second drop-down.
    • speed: sets the continuous rotation speed in degrees per second. Positive values turn counterclockwise and negative values turn clockwise.  When speed is chosen, insert a value block, or any variable or equation that resolves to a value.  Cap the value used here by the project with the Feedback 360° servo setup block.
    • set angle to: sets the servo to the angle specified by the attached value block.  The origin for the angle is the position the servo was in when initialized. Positive values turn counterclockwise and negative values turn clockwise. 
    • change position by: rotates the servo by the number of degrees specified by the attached value block. Positive values turn counterclockwise and negative values turn clockwise. 

Feedback 360° servo get position

Use this block with the Parallax Feedback 360° High-Speed Servo (#900-00360) and the Activity Board WX, Propeller FLiP, and Other board types. Not available for Badge or Scribbler Robot board types.

The Feedback 360° servo get position block provides the angular position of the specified servo.  The origin for the angle is the position the servo was in when initialized.  Set the PIN dropdown to the Propeller I/O pin number connected to the servo's control or feedback signal line — either one will work.


Feedback 360° servo status

The Feedback 360° servo status tests whether the servo is (1/true) or is not (0/false) in the state chosen from the drop-down menu. This block does not change the servo's behavior but merely observes. 

  • First, set the PIN dropdown to the Propeller I/O pin number connected to the servo's control or feedback signal line — either one will work.
  • Then, select behavior to test from the second drop-down:
    • turning a speed
    • moving to a position
    • holding at a position

servo disable

The servo disable block stops any servo control signals being sent by the Propeller I/O pin chosen in the drop-down.  The servo disable block does NOT free up the processor that was launched by the Standard servo or CR servo speed block.