Sphero Command | The Sphero Blocks - Here is a Description of what each does | Variable | Ranges |
Combines heading, speed and time variables to make the robot roll. | Duration Speed Heading |
(0 to 999999 seconds) (0-255) ( degrees 0-359) |
|
Sets the speed of the robot on a scale from 0 to 255. Each robot translates the value differently into a real world speed. For example, Ollie is almost three times faster than Sphero! | Speed | (0-255) | |
Sets the direction at which the robot rolls. 0 degrees heading is straight forward, 90 degrees is a right turn, 270 is a left turn, and 180 degrees is straight backwards. | Heading | (degrees 0-359) | |
Sets the speed to zero on the robot and halts all movement. The rest of the program continues to run as normal. | |||
Turns robot stabilization system on or off for a duration. Stabilization is normally on and enables the robot’s upright position. When it is turned off the robot will not remain upright, enabling unstable behaviours like jumping or wobbling. | Boolean - used for creating true/false statements. | On/Off | |
Controls the power of the left and right motors independently on a scale from 0 to 4095. If you set both motors to full power the robot will jump off the ground. Robot stabilization is disabled for the duration of this unpredictable movement is possible. | Left Motor Power Right Motor Power Duration | (-4095 to 4095) (-4095 to 4095) (0 to 999999 seconds) |
|
Spins the robot for a given number of degrees over time. 360 degrees is a single revolution. | Degrees Duration |
(-999999 to 999999) (0 to 999999 seconds) | |
Changes the colour of the main LED lights. Set this using the colour wheel and brightness slider, or the exact RGB (red, green, blue) values on a scale from 0 – 255. | Red Green Blue Brightness |
(0-255) |
|
Sets the brightness of the back aiming LED (which is limited to blue only) on a scale from 0 to 255. |
Brightness |
(0-255) |
|
Changes from one colour to another over specific time period, measured in seconds. | “From” Colour Red Green Blue Brightness Duration “To” Colour Red Green Blue Brightness |
(0-255) (0-255) (0-255) (0-999999 seconds) (0-255) (0-255) (0-255) |
|
Blinks the main LED lights for a period (time that includes light ON and OFF) for a count of cycles. A short period will produce a fast blink whereas a long period will produce a slow blink. | Red Green Blue Brightness Period Count |
(0-255) (0-255) (0-255) (0-999999) (0-65535) |
|
Controls | |||
Continues to run active blocks until a given amount of time passes. | Delay | (0-999999 seconds) | |
Repeats the bocks contained within it for the number of loops specified, with a minimum of 1. | Count | (0-65535) | |
Repeats the blocks contained within it forever. | |||
Performs the blocks contained within it until a condition is met. | (Condition) | (true or false) | |
Performs the blocks contained within it only if the given condition is true. | (Condition) | (true or false) | |
Performs the blocks contained within “then” if the given condition is true. Otherwise performs the alternate “else” blocks instead. | (Condition) | (true or false) | |
Stops all code on the canvas from executing on the robot, ending the program. | |||
Operators | |||
Assigns a value to a given sensor or variable. Set is the only block in the Operators section. All other tools are to be used within the Set block. | |||
Adds two values together. | Value Value |
(-999999-999999) (-999999-999999) |
|
Subtracts one value from the other. Value Value | Value Value |
(-999999-999999) (-999999-999999) |
|
Multiplies two values together. | Value Value |
(-999999-999999) (-999999-999999) |
|
Divides one value from the other. | Value Value |
(-999999-999999) (-999999-999999) |
|
Multiplies a value within itself a specific number of times. | Value Value |
(-999999-999999) (-999999-999999) |
|
Returns the square root of a value. | Value | (-999999-999999) | |
Rounds a value to the nearest integer value. | Value | (-999999-999999) | |
Rounds a value down to the nearest integer value. | Value | (-999999-999999) | |
Rounds a value up to the nearest integer value. | Value | (-999999-999999) | |
Returns the magnitude of a value, removing its sign. | Value | (-999999-999999) | |
Returns +1 for positive values, -1 for negative values, and 0 for zero. | Value | (-999999-999999) | |
Returns the remainder after division of one value by another. | Value | (-999999-999999) (-999999-999999) |
|
Returns the lesser of two values. Use this to set a lower bound on a value. | Value Value |
(-999999-999999) (-999999-999999) |
|
Returns the greater of two values. Use this to set an upper bound on a value. | Value Value |
(-999999-999999) (-999999-999999) |
|
Generates a random value within the given minimum and maximum. | Minimum Value Maximum Value | (-999999-999999) (-999999-999999) |
|
Comparators | Comparators are used with conditions. | ||
Requires the left value to be equal to the right value for this condition to be true. | Value Value |
(-999999-999999) (-999999-999999) |
|
Requires the left value to be unequal to the right value for this condition to be true. | Value Value |
(-999999-999999) (-999999-999999) |
|
Requires the left value to be less than the right value for this condition to be true. | Value Value |
(-999999-999999) (-999999-999999) |
|
Requires the left value to be less than or equal to the right value for this condition to be true. | Value Value |
(-999999-999999) (-999999-999999) |
|
Requires the left value to be greater than the right value for this condition to be true. | Value Value |
(-999999-999999) (-999999-999999) |
|
Requires the left value to be greater than or equal to the right value for this condition to be true. | Value Value |
(-999999-999999) (-999999-999999) |
|
Requires the left and right comparisons to be true for this condition to be true. | Value Value |
(-999999-999999) (-999999-999999) |
|
Requires the left or right comparison to be true for this condition to be true. | Value Value |
(-999999-999999) (-999999-999999) |
|
Variables | Variables – Create a variable that can be reused throughout a program to limit redundant logic. You can modify the value of a variable by using a set operator block. | ||
Create a variable that can be reused throughout a program to limit redundant logic. | Variable Name Default Value | (-999999-999999) | |
Shows “Delete” and “Edit” icons over existing variables. | |||
Allows user to edit variable name and default value. | |||
Deletes variable. |
|
Events | Description |
Blocks within this event activate when “Start” is pressed in the Lightning Lab app. | |
Conditional logic performed when the robot collides with an object. | |
Conditional logic performed when the robot falls through the air, defined by an accelerometer reading of <0.1 G for a duration of >= 0.1 seconds. Remember that 1 G is resting. | |
Conditional logic performed when the robot lands after an “On Freefall” event. | |
Conditional logic performed when the robot reaches the upper limit of rotational velocity. Gyro max can be triggered by spinning the robot extremely fast. |
Functions | ||
Tool | Description | Variable |
Creates a new Function. Opens “Function” screen which allows user to define parameters and add blocks of code. | Function Name. | |
Shows “Delete” and “Edit” icons over existing functions. | ||
Allows user to edit function. | ||
Deletes function | ||
Creates a new Parameter. | Parameter Name. | |
Shows “Delete” and “Edit” icons over existing parameters. | ||
Allows user to rename the parameter. | ||
Deletes the Parameter. |
Sphero Coding Devices | Rules of Use | The Code Blocks | Exercises to Complete | Advanced Programming Guide | Home |
---|