Computing / Computer Science

Digital Information: Intel Companion Web Site

The Intel video used in this lesson has a companion website which includes supplemental instructional material to reteach or extend the content from the The Digital Information  video.  Lessons 3 through 7 on this page contain interactive animations that reinforce concepts from the video.

Get a Grip

Aerial Robotics 101 - UNDER CONSTRUCTION

STEM Robotics 101_Classroom Management_Course Level Resources

STEM ROBOTICS CLASSROOM MANAGEMENT

First Days of School

Waddle Bot Unit 1 Lesson 4

Incrementing Integers/Counters

 

Sometimes, you will want to be able to count how many times you have gone through a loop. Using a while loop and an integer variable, you can add this functionality. Without the ability to control the number of times a loop occurs, you would be forced to write out all of the commands each time you want to repeat. This leads to a needlessly long program and makes you a less effective programmer. The while loop is constructed like this:

Infinite Loops

 

The while command can only accept a single Boolean value. Whatever is inside the conditional statement will always be evaluated to a Boolean. If we want to force a while block to loop continuously, we can simply put a boolean into the while statement. Doing this with a TRUE value will cause something called in infinite loop. Since there is not a conditional statement to change the evaluation to FALSE, the code block will loop continuously. The while command would look something like this:

Logical Expressions

 

As long as the NXT is on a white board, it will run continuously until it runs into the first black line. While this is going on, the NXT can't do anything but what is included in the while code block. Let's say that we setup a wall around our board. We don't want the NXT to crash into the wall so we need to add a second condition to the while loop. The NXT should leave the while loop if it gets too close to a wall. This would result in the NXT stopping.

Pages