CSD-09 Motor
Instance declaration
When you add a CSD-09 Motor block to the workspace, the following instance declaration is automatically inserted into the Python code:
cheesestick = CheeseStick(0)
csd09 = cheesestick.CSD09()Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| index | Dropdown option | Instance number (starting from 0) | Integer 0 or greater | 0 |
Start the servo motor
Specifies the port to use for the servo motor.
If you do not specify a port, the motor does not work properly.

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| unit | Dropdown option | Servo motor port | Sa, Sb, Sc | - |
Python
cheesestick = CheeseStick(0)
csd09 = cheesestick.CSD09()
csd09.start_servo_motor('Sa')Set the servo motor angle
Sets the angle of the servo motor on the specified port.
The range of values you can choose is 0 to 180.

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| unit | Dropdown option | Servo motor port | Sa, Sb, Sc | The port of the last start_servo_motor |
| value | Input (field) | Angle of rotation (degrees) | Integer 0 to 180 | - |
Python
cheesestick = CheeseStick(0)
csd09 = cheesestick.CSD09()
csd09.set_servo_motor('Sa', 90)Change the servo motor angle
Changes the angle of the servo motor on the specified port.
The range of values you can choose is -180 to 180.

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| unit | Dropdown option | Servo motor port | Sa, Sb, Sc | The port of the last start_servo_motor |
| value | Input (field) | Amount of angle change | Integer | - |
Python
cheesestick = CheeseStick(0)
csd09 = cheesestick.CSD09()
csd09.change_servo_motor('Sa', 10)Stop the servo motor
Turns off the power to the servo motor on the specified port.

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| unit | Dropdown option | Servo motor port | Sa, Sb, Sc | The port of the last start_servo_motor |
Python
cheesestick = CheeseStick(0)
csd09 = cheesestick.CSD09()
csd09.stop_servo_motor('Sa')Start the DC motor
Makes the DC motor controllable using the specified port. You must call it once before using the other DC motor blocks.

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| unit | Dropdown option | DC motor port | Mab, Mcd | - |
Python
cheesestick = CheeseStick(0)
csd09 = cheesestick.CSD09()
csd09.start_dc_motor('Mab')Set the DC motor speed
Sets the PWM output value of the DC motor.

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| unit | Dropdown option | DC motor port | Mab, Mcd | The port of the last start_dc_motor |
| value | Input (field) | PWM output value | Integer 0 to 100 | - |
Python
cheesestick = CheeseStick(0)
csd09 = cheesestick.CSD09()
csd09.set_dc_motor('Mab', 50)Change the DC motor speed
Adds the amount of change you enter to the current PWM output value of the DC motor to set a new value.

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| unit | Dropdown option | DC motor port | Mab, Mcd | The port of the last start_dc_motor |
| value | Input (field) | Amount of PWM change | Integer | - |
Python
cheesestick = CheeseStick(0)
csd09 = cheesestick.CSD09()
csd09.change_dc_motor('Mab', 10)Stop the DC motor
Stops the output of the DC motor.

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| unit | Dropdown option | DC motor port | Mab, Mcd | The port of the last start_dc_motor |
Python
cheesestick = CheeseStick(0)
csd09 = cheesestick.CSD09()
csd09.stop_dc_motor('Mab')Start the step motor
Uses the step motor.

Parameters
(none)
Python
cheesestick = CheeseStick(0)
csd09 = cheesestick.CSD09()
csd09.start_step_motor()Set the step motor mode
Sets the mode used to control the step motor.
If you do not set a mode separately, it defaults to 'power' mode.
Caution! You must not change the mode while the step motor is rotating.

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| unit | Dropdown option | Drive mode | off, normal (wave_step), power (full_step) | - |
Python
cheesestick = CheeseStick(0)
csd09 = cheesestick.CSD09()
csd09.set_step_motor_mode('full_step')Set the step motor speed
Sets the speed of the step motor.
The range of values you can choose is -1000 to 1000.
If the value is negative, it rotates in the opposite direction.

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| value | Input (field) | Rotation speed (pps) | Integer 0 or greater | - |
Python
cheesestick = CheeseStick(0)
csd09 = cheesestick.CSD09()
csd09.set_step_motor_speed(100)Rotate the step motor
Sets the number of pulses to rotate the step motor.
The range of values you can choose is 0 to 65535.
If you have not chosen a speed for the step motor, it does not rotate.
If wait is checked, execution waits until the rotation is complete.

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| value | Input (field) | Number of steps to rotate | Integer | - |
| wait | Checkbox | Whether to wait for completion | TRUE / FALSE | TRUE |
Python
cheesestick = CheeseStick(0)
csd09 = cheesestick.CSD09()
# wait = TRUE
csd09.rotate_step_motor(360, wait=True)
# wait = FALSE
csd09.rotate_step_motor(360, wait=False)Change the step motor speed
Changes the speed of the step motor.
The range of values you can choose is -2000 to 2000.

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| value | Input (field) | Amount of pps change | Integer | - |
Python
cheesestick = CheeseStick(0)
csd09 = cheesestick.CSD09()
csd09.change_step_motor_speed(10)Stop the step motor
Stops the step motor or turns off its power.

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| unit | Dropdown option | Way to stop | stop, power off (power) | - |
Python
cheesestick = CheeseStick(0)
csd09 = cheesestick.CSD09()
# unit = "stop"
csd09.stop_step_motor()
# unit = "power"
csd09.turn_off_step_motor()Accumulated step count
Returns the accumulated number of steps the step motor has rotated so far.

Parameters
(none)
Python
cheesestick = CheeseStick(0)
csd09 = cheesestick.CSD09()
csd09.get_steps()