Looks#
Print#
Print#
The Print block is used to print values or text in the Print Console.
print [Hello] ▶
All reporter blocks will be printed as integer (whole) numbers by default. Use the Set print precision block to adjust the number of decimal places printed.
All new projects begin with the screen cursor at row 1 on the Print Console.
By default, the Print block will remain on the same row for any subsequent print commands. By expanding the Print block to show and set cursor to next row, this will move the cursor to the next row after printing.
print [Hello] ◀ and set cursor to next row
Any block that returns a value can be used in the Print block.
In this example, the 6-Axis Arm’s current y position in mm is printed to the Print Console.
when started :: hat events
[Print the current y position of the Arm in mm.]
print ([arm v] position [y v] in [mm v]) ▶
Next Row#
The Next Row block is used to set the print output cursor on the Print Console.
set cursor to next row
By default, all projects begin with the screen cursor at row 1. The Next Row block will move the cursor down by a single row on the screen. The Next Row block will also set the cursor’s column to position 1.
In this example, the “Hello” will be printed on the 1st row and “world!” on the 2nd row.
when started :: hat events
print [Hello] ▶
set cursor to next row
print [world!] ▶
Set print precision#
The Set print precision block is used to set the number of digits that appear after the decimal point when printing reporter blocks on the Print Console.
set print precision to [0.1 v]
Choose the level of precision that inserted reporter blocks will be printed to the screen.
Ones (1) (Default)
Tenths (0.1)
Hundredths (0.01)
Thousandths (0.001)
All Digits (0.000001)
Choose which device to use.
In this example, the print precision is set to hundredths before printing the current pitch of the 6-Axis Arm.
when started :: hat events
[Print the Arm's current pitch with 2 decimal places.]
set print precision to [0.01 v]
print ([arm v] orientation [pitch v] in degrees) ▶
Clear All Rows#
The Clear All Rows block is used to clear the entire Print Console. Clearing the Print Console will reset the cursor back to the first row.
clear all rows
In this example, the 6-Axis Arm’s current x position is continuously displayed on the Print Console, with the console being cleared and updated in an infinite loop to show the arm’s real-time movement along the x-axis.
when started :: hat events
forever
[Print the Arm's current x position.]
print ([arm v] position [x v] in [mm v]) ◀ and set cursor to next row
[Wait 1 second before clearing.]
wait (1) seconds
clear all rows
Signal Tower#
Set Signal Tower State#
The Set Signal Tower State block is used to set the signal tower’s current color and state.
set [SignalTower1 v] to [green v] and [solid v]
Select which Signal Tower to use.
Select which color on the Signal Tower to set the state of.
red
yellow
green
blue
white
all
Select which state for the specified color on the Signal Tower to be.
off - Turns the color’s light off.
solid - Turns the color’s light on.
blinking - Turns the color’s light on and off repeatedly.
In this example, all of the signal tower’s lights will be set to blinking.
when started :: hat events
set [SignalTower1 v] to [all v] and [blinking v]