122-28176 Parallax Inc, 122-28176 Datasheet - Page 33

GUIDE STUDENT PROCESS CONTROL

122-28176

Manufacturer Part Number
122-28176
Description
GUIDE STUDENT PROCESS CONTROL
Manufacturer
Parallax Inc
Datasheets

Specifications of 122-28176

Accessory Type
Manual
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
Propeller Education (PE) Kit
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
GetCount:
RETURN
SoundTone:
RETURN
Program Discussion
The ConditionalLooping.bs2 program uses conditional loops in a variety of ways. The
DO...LOOP WHILE
true. This occurs while the value of the pushbutton input is 1 or not pressed. Once the
pushbutton is pressed, the condition will be false and the loop will end.
In the
been entered.
in the
In
and will repeat while the value is outside the appropriate range.
In
repeating a sequence a set number of times:
The loop begins with the defined value set to the
loop is performed. When
against the
repeats.
user for
Compare the flowcharts to the code for each routine. The use of either
at the programmer's discretion as long as it performs the task intended.
DO
LOOP WHILE (CountVal > 10)
FOR X = 1 TO CountVal
NEXT
GetCount
SoundTone
DEBUG CR,"Enter the number of times to play (1 to 10)",CR
DEBUGIN DEC CountVal
FREQOUT Buzzer,500,FreqVal
DEBUG "Buzzing ", DEC X,CR
FreqVal
GetFreq
CountVal
FOR variable = Start_Value TO End_Value
X
is started at 1 and the loop continues until
End_value
, a
, a
DEBUGIN
.
DO...LOOP WHILE
routine, the
FOR...NEXT
.
within the
. If the variable is not greater than the
accepts data from the Debug Terminal and stores it as a decimal
NEXT
DO...LOOP UNTIL
WaitForButton
loop is used. This is a special conditional loop used for
is encountered, the variable is incremented and checked
is used to request the number of times to play the tone
' loop while out of range
' Start X at 1 for counting up to CountVal
' Add 1 to X and loop if X <= CountVal
Chapter 1: Process Control and Flowcharts · Page 23
routine will repeat while the condition is
will repeat until a value within range has
Start_Value
X
exceeds the value entered by the
. The code within the
End_Value
WHILE
or
, the loop
UNTIL
is

Related parts for 122-28176