Junior Block Documentation
version 1.1.27
Flight Commands
take off
Block
![](/img/CDPL/blockly_docu/junior/flight_commands/takeoff.png)
Description
This function makes the CoDrone take off from the ground.
Parameters
None
Returns
None
Example
![](/img/CDPL/blockly_docu/junior/flight_commands/takeoff_hover_land_example.png)
land
Block
![](/img/CDPL/blockly_docu/junior/flight_commands/land.png)
Description
This function slowly lands the CoDrone.
Parameters
None
Returns
None
Example
![](/img/CDPL/blockly_docu/junior/flight_commands/takeoff_hover_land_example.png)
emergency stop
Block
![](/img/CDPL/blockly_docu/junior/flight_commands/emergencystop.png)
Description
Stops all commands to motors. The CoDrone will stop flying immediately.
Parameters
None
Returns
None
Example
![](/img/CDPL/blockly_docu/junior/flight_commands/emergencystop_example.png)
go [direction] for [duration] seconds
Block
![](/img/CDPL/blockly_docu/junior/flight_commands/go.png)
Description
CoDrone moves to a given direction for a given duration, in seconds.
Parameters
![](/img/CDPL/blockly_docu/junior/flight_commands/go_params.png)
direction: the direction of flight
duration: the duration of flight, in seconds
Returns
None
Example
![](/img/CDPL/blockly_docu/junior/flight_commands/go_example.png)
go [direction] for [duration] seconds at [power]% power
Block
![](/img/CDPL/blockly_docu/junior/flight_commands/go_power.png)
Description
CoDrone moves to a given direction for a given duration, in seconds, at a given power.
Parameters
![](/img/CDPL/blockly_docu/junior/flight_commands/go_power_params.png)
direction: the direction of flight
duration: the duration of flight, in seconds
power: the power/speed of the flight
Returns
None
Example
![](/img/CDPL/blockly_docu/junior/flight_commands/go_power_example.png)
turn [direction] for [duration] seconds at [power]% power
Block
![](/img/CDPL/blockly_docu/junior/flight_commands/turn_power.png)
Description
Turns the CoDrone to a given direction for a given duration, in seconds, at a given power/speed.
Parameters
![](/img/CDPL/blockly_docu/junior/flight_commands/turn_power_params.png)
direction: the direction of turn
duration: the duration of turn, in seconds
power: the power/speed of the turn
Returns
None
Example
![](/img/CDPL/blockly_docu/junior/flight_commands/turn_power_example.png)
turn 180 degrees
Block
![](/img/CDPL/blockly_docu/junior/flight_commands/turn_180.png)
Description
Turns around the CoDrone 180 degrees
Parameters
None
Returns
None
Example
![](/img/CDPL/blockly_docu/junior/flight_commands/turn_180_example.png)
hover for [duration] seconds
Block
![](/img/CDPL/blockly_docu/junior/flight_commands/hover.png)
Description
Makes the CoDrone hover for a given duration in seconds.
Parameters
duration: the time the CoDrone should hover
Returns
None
Example
![](/img/CDPL/blockly_docu/junior/flight_commands/takeoff_hover_land_example.png)
Flight Sequences
fly in a square
Block
![](/img/CDPL/blockly_docu/junior/flight_sequences/square.png)
Description
CoDrone flies in a square pattern.
Parameters
None
Returns
None
Example
![](/img/CDPL/blockly_docu/junior/flight_sequences/square_example.png)
fly in a circle
Block
![](/img/CDPL/blockly_docu/junior/flight_sequences/circle.png)
Description
CoDrone flies in a circle pattern.
Parameters
None
Returns
None
Example
![](/img/CDPL/blockly_docu/junior/flight_sequences/circle_example.png)
fly in a spiral
Block
![](/img/CDPL/blockly_docu/junior/flight_sequences/spiral.png)
Description
CoDrone flies in a spiral pattern.
Parameters
None
Returns
None
Example
![](/img/CDPL/blockly_docu/junior/flight_sequences/spiral_example.png)
hop forward
Block
![](/img/CDPL/blockly_docu/junior/flight_sequences/hop.png)
Description
CoDrone flies in a forward hop pattern
Parameters
None
Returns
None
Example
![](/img/CDPL/blockly_docu/junior/flight_sequences/hop_example.png)
sway
Block
![](/img/CDPL/blockly_docu/junior/flight_sequences/sway.png)
Description
CoDrone flies in a swaying pattern.
Parameters
None
Returns
None
Example
![](/img/CDPL/blockly_docu/junior/flight_sequences/sway_example.png)
zigzag
Block
![](/img/CDPL/blockly_docu/junior/flight_sequences/zigzag.png)
Description
CoDrone flies in a zigzag pattern.
Parameters
None
Returns
None
Example
![](/img/CDPL/blockly_docu/junior/flight_sequences/zigzag_example.png)
Status Checkers
is code running?
Block
![](/img/CDPL/blockly_docu/junior/status_checkers/is_code_running.png)
Description
Returns a True value while your code is running. Use this block instead of "while True" when you want to run a "forever" loop. Use the "Stop" button in Blockly to stop the program.
Parameters
None
Returns
None
Example
![](/img/CDPL/blockly_docu/junior/status_checkers/is_code_running_example.png)
Sensors
get height from ground
Block
![](/img/CDPL/blockly_docu/junior/sensors/get_height.png)
Description
This function returns the current height of the drone from the object directly below its IR sensor.
Parameters
None
Returns
height: The current height above the object directly below the drone’s IR height sensor as an int (mm).
Example
![](/img/CDPL/blockly_docu/junior/sensors/get_height_example.png)
get battery percentage
Block
![](/img/CDPL/blockly_docu/junior/sensors/get_battery_percentage.png)
Description
This function returns the current battery percentage of the CoDrone, from 0 to 100.
Parameters
None
Returns
percentage: The battery’s percentage as an integer from 0 - 100.
Example
![](/img/CDPL/blockly_docu/junior/sensors/get_battery_percentage_example.png)
get gyro data
Block
![](/img/CDPL/blockly_docu/junior/sensors/get_gyro_angles.png)
Description
This function gets the data from the gyrometer sensor to determine the roll, pitch, and yaw as angles.
Parameters
None
Returns
Returns a list of angles: roll, pitch, and yaw, respectively
Example
![](/img/CDPL/blockly_docu/junior/sensors/get_gyro_angles_example.png)
Lights
set arm color to [color], with a brightness of [brightness]
Block
![](/img/CDPL/blockly_docu/junior/lights/set_armcolor_brightness.png)
Description
CoDrone lights its arms with the given color at a given brightness.
Parameters
![](/img/CDPL/blockly_docu/junior/lights/set_armcolor_brightness_params.png)
color: The color of the arms' LEDs
brightness: The brightness of the arms' LEDs
Returns
None
Example
![](/img/CDPL/blockly_docu/junior/lights/set_armcolor_brightness_example.png)
set arm color to [color], and pattern to [pattern], with a speed of [speed]
Block
![](/img/CDPL/blockly_docu/junior/lights/set_armcolor_pattern_speed.png)
Description
CoDrone lights its arms with the given color and given light pattern at a given speed.
Parameters
![](/img/CDPL/blockly_docu/junior/lights/set_armcolor_pattern_speed_params.png)
color: The color of the arms' LEDs
pattern: The lighting pattern of the arms' LEDs
speed: The speed of the lighting pattern
Returns
None
Example
![](/img/CDPL/blockly_docu/junior/lights/set_armcolor_pattern_speed_example.png)
set eye color to [color], with a brightness of [brightness]
Block
![](/img/CDPL/blockly_docu/junior/lights/set_eyecolor_brightness.png)
Description
CoDrone lights its eyes with the given color at a given brightness.
Parameters
![](/img/CDPL/blockly_docu/junior/lights/set_eyecolor_brightness_params.png)
color: The color of the arms' LEDs
brightness: The brightness of the arms' LEDs
Returns
None
Example
![](/img/CDPL/blockly_docu/junior/lights/set_eyecolor_brightness_example.png)
set eye color to [color], and pattern to [pattern], with a speed of [speed]
Block
![](/img/CDPL/blockly_docu/junior/lights/set_eyecolor_pattern_speed.png)
Description
CoDrone lights its eyes with the given color and given light pattern at a given speed.
Parameters
![](/img/CDPL/blockly_docu/junior/lights/set_eyecolor_pattern_speed_params.png)
color: The color of the eyes' LEDs
pattern: The lighting pattern of the eyes' LEDs
speed: The speed of the lighting pattern
Returns
None
Example
![](/img/CDPL/blockly_docu/junior/lights/set_eyecolor_pattern_speed_example.png)
strobe eye lights
Block
![](/img/CDPL/blockly_docu/junior/lights/strobe_eyelights.png)
Description
CoDrone turns on strobing effect for eye lights.
Parameters
None
Returns
None
Example
![](/img/CDPL/blockly_docu/junior/lights/strobe_eyelights_example.png)
strobe arm lights
Block
![](/img/CDPL/blockly_docu/junior/lights/strobe_armlights.png)
Description
CoDrone turns on strobing effect for arm lights.
Parameters
None
Returns
None
Example
![](/img/CDPL/blockly_docu/junior/lights/strobe_armlights_example.png)
turn eyes off
Block
![](/img/CDPL/blockly_docu/junior/lights/turn_eyes_off.png)
Description
CoDrone's eye lights turn off.
Parameters
None
Returns
None
Example
![](/img/CDPL/blockly_docu/junior/lights/turn_eyes_off_example.png)
turn arms off
Block
![](/img/CDPL/blockly_docu/junior/lights/turn_arms_off.png)
Description
CoDrone's arm lights turn off.
Parameters
None
Returns
None
Example
![](/img/CDPL/blockly_docu/junior/lights/turn_arms_off_example.png)