Skip to content

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:

python
cheesestick = CheeseStick(0)
csd09 = cheesestick.CSD09()

Parameters ​

NameKindDescriptionRange / TypeDefault
indexDropdown optionInstance number (starting from 0)Integer 0 or greater0

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.

start_servo_motor

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionServo motor portSa, Sb, Sc-

Python ​

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.

set_servo_motor

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionServo motor portSa, Sb, ScThe port of the last start_servo_motor
valueInput (field)Angle of rotation (degrees)Integer 0 to 180-

Python ​

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.

change_servo_motor

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionServo motor portSa, Sb, ScThe port of the last start_servo_motor
valueInput (field)Amount of angle changeInteger-

Python ​

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.

stop_servo_motor

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionServo motor portSa, Sb, ScThe port of the last start_servo_motor

Python ​

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.

start_DC_motor

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionDC motor portMab, Mcd-

Python ​

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.

set_DC_motor

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionDC motor portMab, McdThe port of the last start_dc_motor
valueInput (field)PWM output valueInteger 0 to 100-

Python ​

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.

change_DC_motor

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionDC motor portMab, McdThe port of the last start_dc_motor
valueInput (field)Amount of PWM changeInteger-

Python ​

python
cheesestick = CheeseStick(0)
csd09 = cheesestick.CSD09()

csd09.change_dc_motor('Mab', 10)

Stop the DC motor ​

Stops the output of the DC motor.

stop_DC_motor

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionDC motor portMab, McdThe port of the last start_dc_motor

Python ​

python
cheesestick = CheeseStick(0)
csd09 = cheesestick.CSD09()

csd09.stop_dc_motor('Mab')

Start the step motor ​

Uses the step motor.

start_step_motor

Parameters ​

(none)

Python ​

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.

set_step_motor_mode

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionDrive modeoff, normal (wave_step), power (full_step)-

Python ​

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.

set_step_motor_speed

Parameters ​

NameKindDescriptionRange / TypeDefault
valueInput (field)Rotation speed (pps)Integer 0 or greater-

Python ​

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.

rotate_step_motor

Parameters ​

NameKindDescriptionRange / TypeDefault
valueInput (field)Number of steps to rotateInteger-
waitCheckboxWhether to wait for completionTRUE / FALSETRUE

Python ​

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.

change_step_motor_speed

Parameters ​

NameKindDescriptionRange / TypeDefault
valueInput (field)Amount of pps changeInteger-

Python ​

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.

stop_step_motor

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionWay to stopstop, power off (power)-

Python ​

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.

step_motor_steps

Parameters ​

(none)

Python ​

python
cheesestick = CheeseStick(0)
csd09 = cheesestick.CSD09()

csd09.get_steps()