Recent Changes - Search:

TEAMS Academy Wiki


Explore TEAMS!
for visiting sophomores & juniors


Robotics

EnvBioTech

Bat Design

Assistive Tech

Students

Instructors

TEAMS Forum

TEAMS Calendar

TEAMS Web Site

Wiki Info

edit Explore.SideBar

The Control Blocks & What they Do

Back to main page

Here's a description of some of the more useful control blocks...

when

repeat The first argument (at the top) is the number of times to repeat the procedure (a series of commands). The procedure begins below the number, and can consist of as many commands as needed. The repeat function will perform the procedure the specified number of times, then go on to the rest of the program.

loop The loop control works like an infinite repeat command, performing the same sequence of steps again and again and again. A loop can allow you to continuously monitor sensor input.

waituntil This command waits until a certain condition is met, such as a switch being pressed, or a sensor value being greater than or less than a certain number. It then continues with the rest of the code.

if / then This command checks for a certain condition to be met, and if the condition is met, proceeds with the "then" series of commands. If the condition is not met, it proceeds with the rest of the code.

if / then / else This command checks for a certain condition to be met. If the condition is met, it proceeds with the "then" series of commands. If the condition is not met, it proceeds with the "else" series of commands. It then continues with the rest of the code.

stop This command ends the program


Some things to remember about the control blocks

The loop command will run continuously, but the waituntil, if/then, and if/then/else will only check for a condition one time. If you need to do something over and over and over again, you can nest an if/then or if/then/else inside a loop or a repeat command.

The stop command is not technically required. Once the cricket reaches the end of the list of executable commands, it will stop running.


Here's an example!

This Logo Block program will...
  • Turn both motors on
  • Repeat a block of commands eight (8) times
  • In the block of commands it will
    • Turn the motors on for 10 seconds
    • Reverse direction of both motors
Edit - History - Print - Recent Changes - Search
Page last modified on March 06, 2008, at 07:58 PM