Basic Programming


Name of Activity Basic Programming
Author Ali Boreiko
Keywords touch sensor, ultrasonic sensor, sound sensor, light sensor, simple programming, introduction to NXT, introduction to Mindstorms, introduction to programming
Subject NXTs
Grade Level 4, 5, 6, 7, 8
Time 1 Hour Total
Brief Description Students complete a simple series of programming challenges to familiarize themselves with Mindstorms programming.
Lesson Objectives: For students to become more competent programmers
Materials Needed: computers with Mindstorms, whiteboard/chalkboard, a list of simple challenges OPTIONAL: pre-built cars
Preparation and Set Up: 1. Decide what functions of the NXT will be most useful for your class. Do you want them to know how do use a particular sensor? How to steer the robot? How to make the NXT make noises? Then, create a list of ~8 challenges that target these areas of Mindstorm programming (see our example under “References”). Create the challenges so that harder challenges only require the students to change 1 or 2 parts of their program. That way they will see the direct connection between the change they made and the robot’s actions. They will also feel accomplished if they are able to complete more challenges.

2. You may have the students pre-build a car, but the activity can also be done by programming other things (e.g. an NXT arm)

  1. Ask each group to put the necessary sensor/equipment onto their robot.
  2. As a class, program the first challenge. As kids complete the challenge, have them come up to the board and demonstrate the challenge to either STOMPer. Once the students have accomplished and demonstrated the challenge, write their name on the board next to the challenge.
  3. Once kids have finished the first challenge, they may go on to harder challenges–but they must complete them in order!
  4. As kids complete the challenges, check off the challenges under their names. This way, you recognize kids who stay focused on the tasks.
Extensions: This activity can be adapted for various skill levels by simply making the challenges more difficult or adding more difficult ones at the end of the list
Previous Activity (if applicable) Introductory building
References Our list of touch sensor challenges
Umbrella Unit/Curriculum (if applicable) Introduciton to Mindstorms, Introduction to NXT Robotics

Intro to Scratch





Name of Activity Intro to Scratch
Author STOMP
Keywords Scratch, Programming, User Input
Subject Non-LEGO
Grade Level 4, 5, 6
Time 2 Hours Total
Brief Description Students learn basic programming concepts with Scratch, including giving a sprite instructions and having a sprite respond to user input.
Lesson Objectives: - Students are introduced to the Scratch block interface
- Students learn basic motion blocks, including glide, move __ steps, and change x or y
- In the second half of the lesson students get the sprite to move using user input instead of basic instructions
Materials Needed: Computers, preferably one for each student.
Preparation and Set Up: None
Necessary Background None
Procedure If students have never seen programming before, it may be a good idea to start with human robot to get them used to the idea. Another good intro game is to set up the floor space as an xy plane with positive and negative axes. Then do a “simon says” type game where you tell the students coordinate pairs and have them go to the approximate location on the floor. This can be a good way to get them used to the idea of the Cartesian plane if they’ve never seen it before. Show the students an example of a sprite moving to the four corners, and write on the board the blocks they’ll need. Then let the students explore the program a little with this goal in mind until they figure out a way to do it (there are multiple right ways). In the second hour have them move the sprite again, this time using key presses or mouse clicks. Key presses are the easiest, using the when ___ key pressed block under the events section.
Extensions: Challenge the students by asking them to try moving the sprite two or three different ways.

Scratch Challenges!





Name of Activity Scratch Challenges!
Author Emily Taintor
Keywords Scratch, programming, challenges, glide, walk, pattern, draw, pen, costume, 2nd grade, 1 hour
Subject Non-LEGO
Grade Level 2
Time 1 Hour Total
Brief Description Students will complete a series of challenges with help from STOMPers and conclude the lesson with an open-ended challenge.
Lesson Objectives: - Familiarize students with programming
- Introduce logic in programming (if, if-else, etc.)
- Familiarize students with the Scratch program in general and get them comfortable with exploring the less obvious features of the program
Materials Needed: - One laptop per pair of students
- Scratch on every laptop
- Projector (preferably
- Attached worksheet
Preparation and Set Up: Get Scratch running on all the computers, set up one computer on the projector so that you can go over the potential ways to complete the challenges as a class.
Necessary Background Limited programming experience necessary. Familiarity with Scratch is necessary to explain the process to the children.
Procedure - Distribute worksheets to children – Have them work on the challenge worksheet challenge by challenge and go over responses as you go – Synthesize student answers into final program on the projector screen for students who didn’t get it independently
Reference 1 Scratch Programming Challenges
Challenges 1-3 Sample Programs  Challenge1 Challenge2 Challenge3
Umbrella Unit/Curriculum (if applicable) Scratch Programming

Silly Walks





Name of Activity Silly Walks
Author Laura Fradin, Jake Hellman
Keywords NXT, robotics, brick programming, 5th grade, aguayo, wheels, programming. JQS
Subject NXTs
Grade Level 5
Time 1 Hour Total
Brief Description Build and Program a robot that uses something other than wheels to move.
Lesson Objectives: -Understand brick programming
-practice building with NXT kits/pieces
-using non-traditional ways to make the robot move (NO CARS!)
Materials Needed: -NXT kits
-projector (to demonstrate on brick programming and show example video)
Preparation and Set Up: Show kids a video that has examples of Silly (
Procedure 1) Show kids how to attach the motors to the brick. Explain that the motors must be attached tot eh brick in order for the whole thing to move. 2) Demonstrate how to program the robot to go forward (turn it on, NXT program, forward, empty, forward, empty, stop/loop). Make sure each student does this and that their motors work. Explain that it is the ORANGE part of the motor that moves to make sure that things are attached to that. 3) Hand out kits. 4) Allow students to build and test as they build. Help students as needed. 5) Present at the end of class
Extensions: -use more or less motors
-make the robot walk in a way that mimics a real animal
Reference 1

Say Hello!





Name of Activity Say Hello!
Author Laura Fradin, Jake Hellman
Keywords NXT, programming, mindstorms, robotics, aguayo, 5th grade, sensors
Subject NXTs
Grade Level 5
Time 2 Hours Total
Brief Description Students build and program robots that “interact” with the outside world using a sensor.
Lesson Objectives: -Practice building with NXT kits
-Learn how sensors work and where they should be placed in order to work
-Basic Mindstorm Programming
Materials Needed: -NXT kits
Preparation and Set Up: Jake and I made two example robots with two example programs to give them an idea of how sensors work and a very basic program would be done.
(The easy example programs, “Say Hello” and “Touch Sensor”, are attached and on the outline)
Procedure 1) Introduce the Challenge The Challenge: Build a robot (or modify your robot from last week) that “says hello” to you. This means that it acknowledges your existence it some way. This can be it actually saying hello as in our example program, or can merely have it react (back up, turn, make a noise, display a picture, etc.) to a certain stimulus (light, sound, etc). 2) Split students into smaller groups. Run the example program. Have the students tell you what the robot did. Then go through and go step by step to make the program they just witnessed. 3) Have students plan what they want to do (what sensors they will use, what the robot will do after the sensor is activated, etc) 4) Hand out NXT kits. Allow students to build for one class period. 5) The second class period/hour should be spent programming, testing, and re-programming. 6) Allow students to present
Extensions: -use more than one sensor (create a longer code)
Reference 1

The Perfect Puppy





Name of Activity The Perfect Puppy
Author Alison Boreiko
Keywords NXT, introduction to robotics, animal, dog, programming, sensors
Subject NXTs, LEGO Building
Grade Level 5
Time 3 Hours Total
Brief Description Students will combine their knowledge of sensors, programming and building to create their “perfect puppy.”
Lesson Objectives: -Teach students to program with more than one sensor
Materials Needed: -Project Proposal Worksheet
-NXT kits
-*optional: Craft Supplies (for decorating the dog)
Preparation and Set Up: -Make copies of the Project Proposal Worksheets (1 per group)
Procedure 1. Give instructions: Students are to design a pet dog. The dog should use two sensors to mimic dog behavior. 2. Have the students fill out a project proposal form. It’s important that they clearly explain which behavior they wish to mimic and how they will go about mimicking it with the NXT. Demand precision and specificity in their project proposals. 3. Once a group has had their proposal approved, give them their NXT kit and their laptop so they can get to work!
Extensions: Students can continue to develop their robotic dogs.

Challenge Day!





Name of Activity Challenge Day!
Author Jay Clark
Keywords difficulty, tasks, points, programming, risk, reward, risk vs. reward, NXT, MINDSTORMS, 3 Hours Total
Subject NXTs
Grade Level K, 1, 2, 3, 4, 5, 6, 7, 8, 9+
Time 3 Hours Total
Brief Description Students choose from a list of different tasks with a range of difficulty levels and varying point values. The group with the most points at the end of the class period wins!
Lesson Objectives: Review Programming Skills.
A first exposure to making risk/reward decisions.
Materials Needed: One NXT kit per group
Computers with Mindstorms NXT software
Black electrical tape
Preparation and Set Up: Put together a list of challenges on a worksheet. They should range in difficulty level from very, very simple to challenges that are more or less impossible to complete. Assign point values to the activities based on their difficulty, keeping in mind that close scores are more fun and drive the students to keep working. An example worksheet is attached below.
Necessary Background This activity is as much of an activity in assessing risk/reward and strategy as it is in programming. Some students will complete many tasks with simple, fundamental programming. Others will bite off more than they can chew, and end up without many points at all.
  • Introduce challenge day and go over what each challenge calls for specifically.
  • Hand out worksheets and set a strict time limit.
  • Update scores on an overhead or white board.
  • After the time is up, talk with children about risk/reward, and about how hard each challenge was. If they could do it over again, which would they choose? which were fastest.
Reference 1

NXT Musical Instrument





Name of Activity NXT Musical Instrument
Author Jay Clark
Keywords Mary Had A Little Lamb, simple song, NXT, switches, sensors, task, instrument, wiring, math blocks, programming, loops, MINDSTORMS, Music Engineering, numerical frequency, audible, pitch, 2 Hours Total
Subject NXTs
Grade Level 4, 5, 6, 7, 8, 9+
Time 2 Hours Total
Brief Description Students will play “Mary Had A Little Lamb” and other simple songs on their NXT using switches and touch sensors. When students complete that task, they will make an instrument using other sensors, requiring wiring and math blocks in their programs.
Lesson Objectives: Learn about loops, switches, and math blocks
Introduce Musical Instrument Engineering
Understand the relationship between numerical frequency and audible pitch
Materials Needed: NXT Kit
Computer with MINDSTORMS NXT software
Necessary Background Mary had a little lamb is a simple song consisting of just three notes. The notes and corresponding lyrics are below:


ma-ry had a lit-tle lamb


lit-tle lamb, lit-tle lamb


mar-y had a lit-tle lamb


whose fleece was white as snow

All musical notes have a corresponding frequency. Concert A (or middle A) is 440 Hz. In order to play mary had a little lamb using a light or distance sensor, you must know the frequencies of the three notes you’re using:

C – 262

D – 294

E – 330


frequency – the rate at which a vibration occurs. Determines the pitch of a note.

Procedure Introduction Introduce switches to the students. A switch is a program structure that makes decisions based on external criteria, such as a sensor value. Introduce the lesson. Show the students the notes of Mary had a little lamb. Ask them how many touch sensors they would need to play it. Guide them to realize that they could use 2, and there are 4 opportunities for notes to play with two touch sensors: Left pressed, right pressed, both pressed, none pressed. Guide them through brainstorming how the program should look. Usually it’s hard for them to see that the second switch is required. ActivityHave the students program their robots to be able to play mary had a little lamb using switch blocks and sound blocks. When they finish, have them use another sensor and wiring and math blocks in their program to create another musical instrument. Or allow them to use switches with another sensor to set up ranges for each note.
Extensions: Play a different song!
Use touch sensors in conjunction with another sensor to set the octave.
Reference 1

Speed Fans





Name of Activity Speed Fans
Author STOMP
Keywords fan, LEGO, speed, touch sensor, programming, 1 Hour Total, 4-6
Subject NXTs
Grade Level 4, 5, 6
Time 1 Hour Total
Brief Description The activity involves building a fan out of LEGOs and creating a MINDSTORMS program that will change the speed of the fan every time the touch sensor is pressed.
Lesson Objectives: Gain basic understanding of programming with MINDSTORMS.
Materials Needed: NXT Kits/ RCX Kits.

Computers with MINDSTORMS or ROBOLAB installed.

Necessary Background Knowledge of programming with MINDSTORMS.


Touch sensor

Power Levels

Procedure 1) Explain the basics of programming. 2) Distribute the kits and explain the task ( i.e. to build a fan that changes speed when the touch sensor is pressed) 3) Have the students build a fan out of LEGOs in their kits. 4) Let the students try to figure out how to program the fan on their own. If they need help explain to them how the power level of the motor can be changed every time the touch sensor is pressed thus changing the speed of the fan.
Extensions: Program the fan using loops.
Use the activity to talk about air flow.

Say “Hello”





Name of Activity Say “Hello”
Author STOMP
Keywords NXT, communicate, message, programming, MINDSTORMS
Subject NXTs
Grade Level 4, 5, 6, 7, 8, 9+
Time 1 Hour Total
Brief Description Students will program their NXT to communicate a message.
Lesson Objectives: To learn about how to communicate a message using MINDSTORMS NXT software.
Materials Needed: - One NXT brick per student pair.
- Computer running MINDSTORMS NXT software.
Preparation and Set Up: - Set up computers running MINDSTORMS NXT software.
- Arrange students in pairs.
- Distribute NXT bricks.
  1. Program the NXT to display text on the screen and say hello when a touch sensor is pressed.
    1. Program the NXT to wait for the touch sensor
    2. After the touch sensor has been pressed students will program their computer to convey a message using sound and the NXT display.
    3. When the program is over clear the display.
    4. Loop the program so that the message can be displayed every time the touch sensor is pressed.
  2. Have studnets test and redesign their program. Students can change the message if they desire.
Extensions: - Add a graphic to the display.
- Build a flag or arm to wave to add to your greeting.
Reference 1
Reference 2
Reference 3

Switch to our mobile site