Skip to content

HAT-010 5x5 Matrix ​

Instance declaration ​

When you add a HAT-010 5x5 Matrix block to the workspace, the following instance declaration is automatically inserted into the Python code:

python
cheesestick = CheeseStick(0)
hat010 = cheesestick.HAT010()

Parameters ​

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

Start the LED matrix ​

Uses the 5x5 matrix.

start

Parameters ​

(none)

Python ​

python
cheesestick = CheeseStick(0)
hat010 = cheesestick.HAT010()

hat010.start()

Turn on one dot ​

Sets the LED color at the specified position.
The LED position is given as x, y coordinates.

set_one

Parameters ​

NameKindDescriptionRange / TypeDefault
xInput (field)Horizontal coordinateInteger 0 to 4-
yInput (field)Vertical coordinateInteger 0 to 4-
colorDropdown optionColoroff, red, orange, yellow, green, cyan, blue, violet, magenta, white-

Python ​

python
cheesestick = CheeseStick(0)
hat010 = cheesestick.HAT010()

hat010.set_one(2, 3, 'red')

Draw a shape ​

Turns on the LEDs in the configured pattern, starting from the specified position.
The LED position is given as x, y coordinates.

draw_shape

Parameters ​

NameKindDescriptionRange / TypeDefault
xInput (field)x of the top-left corner of the shapeInteger-
yInput (field)y of the top-left corner of the shapeInteger-
colorDropdown optionColoroff, red, orange, yellow, green, cyan, blue, violet, magenta, white-
shapeDropdown optionShape namerectangle, triangle, diamond, circle, x, like, dislike, angry, mouth_open, mouth_close, heart, star, up_arrow, down_arrow, left_arrow, right_arrow, walking, dog, butterfly, airplane, quarter_note, eighth_note-

Python ​

python
cheesestick = CheeseStick(0)
hat010 = cheesestick.HAT010()

hat010.draw_shape(0, 0, 'red', 'heart')

Draw a number ​

Turns on the LEDs in the configured pattern, starting from the specified position.
The LED position is given as x, y coordinates.

draw_number

Parameters ​

NameKindDescriptionRange / TypeDefault
xInput (field)x of the top-left corner of the numberInteger-
yInput (field)y of the top-left corner of the numberInteger-
colorDropdown optionColoroff, red, orange, yellow, green, cyan, blue, violet, magenta, white-
numberDropdown optionNumber to draw0, 1, 2, 3, 4, 5, 6, 7, 8, 9-

Python ​

python
cheesestick = CheeseStick(0)
hat010 = cheesestick.HAT010()

hat010.draw_number(0, 0, 'red', 5)

Draw a pattern ​

Turns on the LEDs in the configured pattern, starting from the specified position.
The LED position is given as x, y coordinates.

draw_pattern

Parameters ​

NameKindDescriptionRange / TypeDefault
xInput (field)x of the top-left cornerInteger-
yInput (field)y of the top-left cornerInteger-
colorDropdown optionColoroff, red, orange, yellow, green, cyan, blue, violet, magenta, white-
matrixInput (array)A 25-cell pixel array (0/1)An integer array of length 25-

Python ​

python
cheesestick = CheeseStick(0)
hat010 = cheesestick.HAT010()

hat010.draw_pattern(0, 0, 'red', [
   1, 0, 1, 0, 1, 
   0, 1, 0, 1, 0, 
   1, 0, 1, 0, 1, 
   0, 1, 0, 1, 0, 
   1, 0, 1, 0, 1
])

Move the matrix ​

Moves the display by the specified x, y amounts.
If the x value is positive the display moves to the right, and if it is negative it moves to the left.
If the y value is positive the display moves down, and if it is negative it moves up.

shift

Parameters ​

NameKindDescriptionRange / TypeDefault
xInput (field)Horizontal amount to moveInteger-
yInput (field)Vertical amount to moveInteger-

Python ​

python
cheesestick = CheeseStick(0)
hat010 = cheesestick.HAT010()

hat010.shift(1, 0)

Turn off one dot ​

Turns off the LED at the specified position.
The LED position is given as x, y coordinates.

turn_off_one

Parameters ​

NameKindDescriptionRange / TypeDefault
xInput (field)Horizontal coordinateInteger 0 to 4-
yInput (field)Vertical coordinateInteger 0 to 4-

Python ​

python
cheesestick = CheeseStick(0)
hat010 = cheesestick.HAT010()

hat010.turn_off_one(2, 3)

Turn off all ​

Turns off all the LEDs shown on the display.

turn_off_all

Parameters ​

(none)

Python ​

python
cheesestick = CheeseStick(0)
hat010 = cheesestick.HAT010()

hat010.turn_off_all()

Set the brightness ​

Sets the brightness of the 5x5 matrix.
The range of values you can choose is 0 to 100.

set_brightness

Parameters ​

NameKindDescriptionRange / TypeDefault
valueInput (field)BrightnessInteger 0 to 100-

Python ​

python
cheesestick = CheeseStick(0)
hat010 = cheesestick.HAT010()

hat010.set_brightness(50)

Change the brightness ​

Changes the brightness of the 5x5 matrix.
The range of values you can choose is -100 to 100.

change_brightness

Parameters ​

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

Python ​

python
cheesestick = CheeseStick(0)
hat010 = cheesestick.HAT010()

hat010.change_brightness(10)

Button input value ​

The input state of the selected button
It outputs 0 if the button is pressed, and 1 if the button is not pressed.

button_input

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionButton namebutton A ('A'), button B ('B')-

Python ​

python
cheesestick = CheeseStick(0)
hat010 = cheesestick.HAT010()

hat010.button_input('A')

Was the button clicked? ​

Whether the selected button was clicked
This block returns true only at the moment the selected button is clicked, and false otherwise.

button_click

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionButton namebutton A ('A'), button B ('B')-

Python ​

python
cheesestick = CheeseStick(0)
hat010 = cheesestick.HAT010()

hat010.button_click('A')