Set some benchmarks.

Provide basic data, use basic commands, use systematic processes.

First plan, what code do you need?

  1. One foot
    1. Using a ruler, how accurately can you move the Sphero exactly 1 foot and stop?
    2. Repeat the program 3 times and measure how close the robot is to the end of the ruler.
      1. Run #1: _________________
      2. Run #2: __________________
      3. Run #3: _________________
  2. Square Chair
    1. Use loops and moves and turns to have the robot move in a square around 1 chair.
    2. Make the lights change color when it is finished.
    3. The robot should stop in exactly the same place as it started.
    4. Run the program twice in a row and have someone from another group circle how it worked and write their:
      1. The program worked (very well, OK, barely, not at all) _________________________ (name)
  3. Knock Knock
    1. Have the robot tell a knock knock joke where it pauses long enough for you to give the responses
      1. robot: "knock knock"
      2. you: who's there?
      3. robot: __________________-
      4. you: ___________ who?
      5. robot: ____________________ (punch line)
    2. Demonstrate your program
  4. Spinning top.
    1. enter and modify this program to show yellow when sitting still, red when spinning clockwise, green when spinning counterclockwise.

Spinning Top

This program uses a  > operator combined with an if then, else statement to modulate color values based on the Gyroscopic Rotation.

Spin the robot like a top clockwise (negative) to see the red LED channel, or spin it counterclockwise (positive) to see the green LED channel:

async function startProgram() {
 	while (true) {
 		if ((getGyroscope().yaw > 1.0)) {
 			setMainLed({ r: 0, g: getGyroscope().yaw / 7.84, b: 0 });
 		} else {
 			setMainLed({ r: Math.abs(getGyroscope().yaw / 7.84), g: 0, b: 0 });
 		await delay(0.25);

The Spinning Top shows that the combining several programming fundamentals like Control Flow, Operators, Comparators and Sensors unleashes the creative power of programming. You also used a new tool called "normaliziation" in this program. Normalizing modifies a value so it fits within a different range, just like how percentages normalize any 2 numbers from 0 - 100%. getGyroscope().yaw / 7.84 ensures that gyro values will generate valid setMainLed values. This is needed because the gyro range is -2,000° - 2,000°, whereas the LED range is 0-255. Hence, our normalization rate can be calculated as 2,000 / 255 = 7.84.