Skip to content

Cheese Stick ​

Instance declaration ​

When you add a Cheese Stick block to the workspace, the following instance declaration is automatically inserted into the Python code:

python
cheesestick = CheeseStick(0)
# When there are multiple instances
cheesestick_1 = CheeseStick(1)

Parameters ​

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

Set the input mode ​

Sets the input mode of the selected port.

set_input_mode

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionInput portSa, Sb, Sc, La, Lb, Lc-
optionDropdown optionInput modemakey, button, digital pullup (digital_pullup), digital pulldown (digital_pulldown), analog, analog voltage (analog_voltage)-

Python ​

python
cheesestick = CheeseStick(0)

cheesestick.set_input_mode('Sa', 'button')

Set the input range ​

Converts the input value of the selected port to the minimum~maximum range you specify.
The range of the input value is 0 to 255.
The range of values it can be converted to is -100 to 100.

set_input_range

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionInput portSa, Sb, Sc, La, Lb, Lc-
src_minInput (field)Source minimumInteger 0 to 255-
src_maxInput (field)Source maximumInteger 0 to 255-
dst_minInput (field)Minimum after conversionInteger -100 to 100-
dst_maxInput (field)Maximum after conversionInteger -100 to 100-

Python ​

python
cheesestick = CheeseStick(0)

cheesestick.set_input_range('Sa', 0, 255, 0, 100)

Set the input range with a median ​

Converts the input value of the selected port to the minimum~median~maximum range you specify.
The range of the input value is 0 to 255.
The range of values it can be converted to is -100 to 100.

set_input_range_median

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionInput portSa, Sb, Sc, La, Lb, Lc-
src_minInput (field)Source minimumInteger 0 to 255-
src_medianInput (field)Source medianInteger 0 to 255-
src_maxInput (field)Source maximumInteger 0 to 255-
dst_minInput (field)Minimum after conversionInteger -100 to 100-
dst_medianInput (field)Median after conversionInteger -100 to 100-
dst_maxInput (field)Maximum after conversionInteger -100 to 100-

Python ​

python
cheesestick = CheeseStick(0)

cheesestick.set_input_range_median('Sa', 0, 128, 255, -100, 0, 100)

Input value ​

The input value of the selected port

get_input

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionInput portSa, Sb, Sc, La, Lb, Lc-

Python ​

python
cheesestick = CheeseStick(0)

cheesestick.get_input('Sa')

Set the pulse input mode ​

Sets the pulse input mode of the selected port.

set_pulse_input_mode

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionPulse input portSc, Lc-
optionDropdown optionPull modepulse (default), pulse(pull-up) (pull-up), pulse(pull-down) (pull-down)-

Python ​

python
cheesestick = CheeseStick(0)

cheesestick.set_pulse_input_mode('Sc', 'pull-up')

Pulse input value ​

Whether a pulse input was detected on the selected port

get_pulse_input

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionPulse input portSc, Lc-

Python ​

python
cheesestick = CheeseStick(0)

cheesestick.get_pulse_input('Sc')

Set the digital output ​

Sets the digital output value of the specified port.
The values you can choose are 0 and 1.

set_digital_output

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionDigital output portSa, Sb, Sc, La, Lb, Lc, Mab, Mcd-
valueDropdown optionOutput value0 or 1-

Python ​

python
cheesestick = CheeseStick(0)

cheesestick.set_digital_output('Sa', 1)

Set the PWM output ​

Sets the PWM output value of the specified port.
The range of values you can choose is 0 to 100.

set_pwm_output

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionPWM output portSa, Sb, Sc, La, Lb, Lc-
valueInput (field)PWM valueInteger 0 to 100-

Python ​

python
cheesestick = CheeseStick(0)

cheesestick.set_pwm_output('Sa', 50)

Change the PWM output ​

Changes the PWM output value of the specified port.
The range of values you can choose is -100 to 100.

change_pwm_output

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionPWM output portSa, Sb, Sc, La, Lb, Lc-
valueInput (field)Amount of PWM changeInteger -100 to 100-

Python ​

python
cheesestick = CheeseStick(0)

cheesestick.change_pwm_output('Sa', 10)

Set sound buzz ​

Sets the buzzer sound of Cheese Stick.

sound_buzz

Parameters ​

NameKindDescriptionRange / TypeDefault
hzInput (block)Frequency (Hz)Real number 0 to 6553.5-

Python ​

python
cheesestick = CheeseStick(0)

cheesestick.sound_buzz(440)

Play a note ​

Cheese Stick plays the specified note.

sound_note

Parameters ​

NameKindDescriptionRange / TypeDefault
noteDropdown optionNoteDo (C), Do# (C#), Re (D), Re# (D#), Mi (E), Fa (F), Fa# (F#), Sol (G), Sol# (G#), La (A), La# (A#), Si (B)-
octaveDropdown optionOctave1, 2, 3, 4, 5, 6, 74

Python ​

python
cheesestick = CheeseStick(0)

cheesestick.sound_note('D', 5)

Play a sound clip ​

Cheese Stick plays a particular sound clip.

sound_clip

Parameters ​

NameKindDescriptionRange / TypeDefault
clipDropdown optionSound clip name'mute', 'beep', 'siren', 'engine', 'robot', 'happy', 'angry', 'sad', and so on-
waitCheckboxWhether to wait for completionTRUE / FALSETRUE

Python ​

python
cheesestick = CheeseStick(0)

cheesestick.sound_clip('siren', wait=True)

Sound off ​

Turns off the sound of Cheese Stick.

sound_off

Parameters ​

(none)

Python ​

python
cheesestick = CheeseStick(0)

cheesestick.sound_off()

Acceleration value ​

The gravitational acceleration value along a particular axis

acceleration

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionAxis to measurex, y, z-

Python ​

python
cheesestick = CheeseStick(0)

cheesestick.acceleration('x')

Temperature sensor value ​

The temperature sensor value

temperature

Parameters ​

(none)

Python ​

python
cheesestick = CheeseStick(0)

cheesestick.temperature()

Signal strength value ​

The signal strength

signal_strength

Parameters ​

(none)

Python ​

python
cheesestick = CheeseStick(0)

cheesestick.signal_strength()

Battery voltage ​

The battery voltage

battery

Parameters ​

(none)

Python ​

python
cheesestick = CheeseStick(0)

cheesestick.battery()

Whether the state has changed ​

Whether the state of the robot has changed

state_change

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionKind of state0 to 7 (see the table below)-
unitCondition
0acceleration('x') > 960
1acceleration('x') < -960
2acceleration('y') > 960
3acceleration('y') < -960
4acceleration('z') > 960
5acceleration('z') < -960
6tap() (tap event)
7fall() (fall event)

Python ​

python
cheesestick = CheeseStick(0)

cheesestick.acceleration('x') > 960
cheesestick.tap()    # case 6
cheesestick.fall()   # case 7