An exercise showing how NXT-G programs run

Eight students who are good at following instructions are needed for this simulation. Each student will be simulating a particular part of an NXT-G program. The exercise is not intended to be 100% technically accurate, but instead, to give the students a better understanding of how NXT-G programs actually work.

The simulation we'll be doing has only one loop, but additional loops could be added for a larger group of students. Feel free to innovate and extend it -- I'll be happy to integrate improvements, so please let me know.

This webpage is meant to be printed out. Cut the pages along the horizontal rules, resulting in instruction sheets that can be given to each student.

Here's an example simple NXT-G program with two loops, for reference as to how things are laid out positionally:

Setup

As "coordinator" you'll help ensure each student follows the instructions on their page. Have the students stand in locations corresponding with the on-screen layout of the same component in the program. More or less, that'll be:

              [you]
[start button] [stop button]  [sonar sensor]
[start block]
[sequence beam]  [loop]..........................................
                            [sonar block] [display block]
                                          [whiteboard]

Running the program

Once all of the parts of the program are in place, with each component knowing their role and their inputs/outputs, the coordinator can run and stop the program by pushing the "start" and "stop" buttons. I recommend allowing the loop to run 3 or 4 times before stopping the program.

Providing "input" to the SONAR sensor

Before the program gets to where its sampling the SONAR sensor, put your hand a foot or two in front of the "sensor" to give them a clear indicator of what their "output" should be.

NXT-G Program Components



You are: the orange START button!

When "pushed" (tapped on the shoulder) you: raise your hand until the "start block" sees you.

When not pushed, you: lower your hand and stand quietly.

CNXT1.png


You are: the grey STOP button!

When "pushed" (tapped on the shoulder) you: raise your hand until the "start block" sees you.

When not pushed, you: lower your hand and stand quietly.

CNXT1.png


You are: the start block!

You know who the stop button is, who the start button is, and who your sequence beam is. You're always on the lookout!

If the program is running, you're looking at the STOP button.
If the STOP button is pressed (raises their hand) stop the sequence beams (tap them on the shoulder).

If the program is stopped, you're looking at the START button.
If the START button is pressed (raises their hand) start the sequence beams (again, just tap them on the shoulder).



You are: a SEQUENCE beam!

You know who the start block is, and you know what blocks are "on" you. For this exercise that's only one - the loop block.

When the "start block" starts you (taps you on your shoulder), go one by one along your list of blocks, running each one.
When the "start block" stops you, stop whatever block you might be running at the time (the loop) the same way.

1-8.png


You are: an infinite LOOP block!

You're started and stopped with a tap on the shoulder.

You know what sequence beam you are "on".
You know what blocks are "inside" of you.

When "started" you: go one by one along the blocks "inside" of you, running each one.
When done with the last one, you go back to the beginning of the list, and start again.

When "stopped", no matter where you are, you stop. If started again, you start from the BEGINNING of your list.

fig2.jpg


You are: a SONAR sensor!

When "sampled" (touched on the shoulder) you:
look forward
estimate how far your nose is from the first thing in front of you
whisper your answer to the SONAR block that "sampled" you.



You are: a SONAR block!

You know what sequence beam you are on (you're inside the loop, on ITS sequence beam)
You know who your SONAR sensor is

When "run" you:
tap your sonar sensor on the shoulder
wait while they look and estimate
let them answer their "sample value"
go back to your original spot inside the "loop"
whisper the "sample value" to the next block inside the loop

sonarCalibV1.jpg


You are: a DISPLAY block!
(however, you'll just display a number, not draw the american flag!)

You know what sequence beam you're on (the loop)
You know where your "input" is coming from (the SONAR block)
You're the only one with a dry-erase marker.

When whispered to, you remember the number you were told.

When "run" by the loop, you:
erase anything you might have written before on the white board
write down the number that was whispered to you

Topic revision: r4 - 2013.01.06 - PaulReiber
 
Copyright © is by author. All material on this collaboration platform is the property of its contributing author.