Skip to main content

Junior Block Documentation

version 2.90

Driving​

forward​

Description​

Moves Zumi forward for the given duration and speed

Parameters​

float seconds: A value, in seconds, for the duration of the movement.
integer speed: A value (0 - 100) for the speed of the movement.

None

reverse​

Description​

Moves Zumi backwards for the given duration and speed

Parameters​

float seconds: A value, in seconds, for the duration of the movement.
integer speed: A value (0 - 100) for the speed of the movement.

None

turn left​

Description​

Turns Zumi to the left a number of specified degrees.

Parameters​

integer degrees: The angle of the left turn in degrees

None

turn right​

Description​

Turns Zumi to the right a number of specified degrees.

Parameters​

integer degrees: The angle of the right turn in degrees

None

stop​

Description​

Stops Zumi's motors when running indefinite move commands such as the Senior forward_step() block.

None

None

left u turn​

Description​

Makes Zumi perform a left "U-turn". As the speed increases, the turn radius gets larger.

Parameters​

integer speed: The speed of the U-turn (0 - 100)

None

right u turn​

Description​

Makes Zumi perform a right "U-turn". As the speed increases, the turn radius gets larger.

Parameters​

integer speed: The speed of the U-turn (0 - 100)

None

parallel park​

Description​

Drives Zumi in reverse into a parallel park.

None

None

calibrate gyro​

Description​

Recalibrates Zumi's gyroscope. Use when the gyroscope returns values with high error due to drift. During recalibration, Zumi should be stationary on a flat surface.

None

None

Example​

In this example/scenario, the Zumi wasn't driving straight when the first forward block ran, drifting off to the side. After the calibrate gyro block and the second forward block ran, Zumi was able to drive straight as it should.

Shapes​

triangle​

Description​

Drives Zumi in the shape of a triangle using either left or right turns.

Parameters​

left: Makes a triangle with left turns
right: Makes a triangle with right turns

None

square​

Description​

Drives Zumi in the shape of a square using either left or right turns.

Parameters​

left: Makes a square with left turns.
right: Makes a square with right turns.

None

rectangle​

Description​

Drives Zumi in the shape of a rectangle using either left or right turns.

Parameters​

left: Makes a rectangle with left turns.
right: Makes a rectangle with right turns.

None

circle​

Description​

Drives Zumi in the shape of a circle using either left or right turns.

Parameters​

left: Makes a circle turning to the left.
right: Makes a circle turning to the right.

None

figure 8​

Description​

Drives Zumi in the shape of a figure 8. Zumi does a full circle to the right, and then a full circle to the left.

None

None

j turn​

Description​

Drives Zumi in the shape of a J turn. Zumi will start by driving forward

None

None

Screen​

draw text​

Description​

Draws a string of letters and characters and centers them on Zumi's screen. The screen can draw a maximum of three lines of text, each around 14 characters long.

Parameters​

string text: Inputted text to display

None

sad​

Description​

Displays Zumi's sad eyes on the screen.

None

None

closed​

Description​

Displays Zumi's closed eyes on the screen.

None

None

sleepy​

Description​

Displays Zumi's sleepy eyes on the screen.

None

None

happy​

Description​

Displays Zumi's happy eye animation on the screen.

None

None

glimmer​

Description​

Displays Zumi's glimmer eye animation on the screen.

None

None

blinking​

Description​

Displays Zumi's blinking eye animation on the screen.

None

None

angry​

Description​

Displays Zumi's angry eyes on the screen.

None

None

open​

Description​

Displays Zumi's open eyes on the screen.

None

None

Sounds​

play note​

Description​

Plays a single note for a specified duration in milliseconds.

Parameters​

note: The note that is played. Ranging from C2 to B6
integer duration: The duration of note played in milliseconds

None

angry​

Description​

Plays Zumi's angry sound effect.

None

None

happy​

Description​

Plays Zumi's happy sound effect.

None

None

Description​

Plays Zumi's blinking sound effect.

None

None

celebrate​

Description​

Plays Zumi's celebration sound effect.

None

None

wakeup​

Description​

Plays Zumi's wake up sound effect.

None

None

disoriented​

Description​

Plays Zumi's disoriented sound effect.

None

None

oops front​

Description​

Plays Zumi's front sensor detect sound effect.

None

None

oops back​

Description​

Plays Zumi's back sensor detect sound effect.

None

None

Sensors​

get IR reading​

Description​

Gets the current IR reading from Zumi's sensors. The closer the value is to 0, the more IR light is being detected. Used commonly when detecting objects since an object or obstacle nearby will reflect IR light back to the receiver.

Returns​

integer IR sensor value: The amount of IR light being detected by the IR sensor (0 - 255)

get z angle​

Description​

Gets the current Z angle from Zumi's gyroscope.

None

Returns​

integer angle: The z-angle of the gyroscope reading (0 - 360)

get x angle​

Description​

Gets the current X angle from Zumi's gyroscope.

None

Returns​

integer angle: The x-angle of the gyroscope reading (0 - 360)

Example​

With this example, tilt Zumi left and right with your hands to see the X angle change!

get y angle​

Description​

Gets the current Y angle from Zumi's gyroscope.

None

Returns​

integer angle: The y-angle of the gyroscope reading (0 - 360)

Example​

With this example, rock Zumi forward and backward with your hands to see the Y angle change!

reset gyro​

Description​

Resets Zumi's gyroscope x, y, and z angles to 0. Use this function to reset Zumi's heading.

None

None

get battery voltage​

Description​

Gets the current voltage from Zumi's battery. It typically varies from 3.45V-4.14V when not connected over USB. If connected over USB, this function may return 1.7V or below.

None

Returns​

float voltage: The battery's voltage in units of Volts

get battery percentage​

Description​

Gets the current battery percentage from Zumi's battery when not connected over USB power. The percentage will vary while driving since it is dependent on battery voltage.

None

Returns​

integer percent: The battery's percentage (0 - 100)

Camera​

import camera​

Description​

Imports the camera library. This block must be included at the top of any code that uses camera functions.

None

None

start camera​

Description​

Turns on Zumi's camera. A red LED will turn on next to the camera to indicate the camera is on. The camera needs to turn on before taking any pictures and will stay on until it is manually turned off with the close_camera() block.

None

None

close camera​

Description​

Turns off Zumi's camera. It is recommended to always turn off the camera when not in use to conserve battery. The camera cannot be started again unless the camera is already off.

None

None

take picture​

Description​

Captures a color image with Zumi's camera and stores the array as a frame object. Use the image object with show_image() to display in Blockly. This block cannot be used without importing and starting the camera.

None

Returns​

ndarray image: An image composed of a NumPy 160x128 array of pixels.

show image​

Description​

Show an image that was taken with Zumi's camera in Blockly.

Parameters​

ndarray image: An image composed of a NumPy array of pixels.

None

get QR code message​

Description​

Searches an image for a QR code message. If a QR code was found, the encoded message is saved to a string.

Parameters​

ndarray image: An image composed of a NumPy array of pixels.

Returns​

string message: The decoded message of the QR code. Returns `None` if no QR code was detected.

find stop sign​

Description​

Searches an image for a stop sign. Returns True if a stop sign was found.

Parameters​

ndarray image: An image composed of a NumPy array of pixels.

Returns​

boolean detection: Returns True if a stop sign was detected. Otherwise, returns False.

find face​

Description​

Searches an image for a face. Returns True if a face was detected

Parameters​

ndarray image: An image composed of a NumPy array of pixels.

Returns​

boolean detection: Returns True if a face was detected. Otherwise, returns False.

AI​

prediction from frame​

Description​

Predicts a label from an image based on a previously trained color model. A KNN color model needs to be trained and loaded into the program to use predict_from_frame().

Parameters​

ndarray image: An image composed of a NumPy array of pixels.

Returns​

string label: The predicted label based on the image.

Lights​

lights on​

Description​

Turns on both Zumi's headlights and brake lights.

None

None

lights off​

Description​

Turns off both Zumi's headlights and brake lights.

None

None

headlights on​

Description​

Turns on Zumi's headlights.

None

None

headlights off​

Description​

Turns off Zumi's headlights.

None

None

brake lights on​

Description​

Turns on Zumi's brake lights.

None

None

brake lights off​

Description​

Turns off Zumi's brake lights.

None

None

hazard lights on​

Description​

Turns on Zumi's flashing hazard lights. They will flash indefinitely until turned off.

None

None

hazard lights off​

Description​

Turns off Zumi's flashing hazard lights.

None

None

left signal on​

Description​

Turns on Zumi's left turn signal. This function flashes Zumi's back left red LED until turned off.

None

None

left signal off​

Description​

Turns off Zumi's flashing left turn signal.

None

None

right signal on​

Description​

Turns on Zumi's right turn signal. This function flashes Zumi's back right red LED until turned off.

None

None

right signal off​

Description​

Turns off Zumi's flashing right turn signal.

None

None