28139 Parallax Inc, 28139 Datasheet - Page 104

KIT REMOTE IR FOR BOE-BOT W/TEXT

28139

Manufacturer Part Number
28139
Description
KIT REMOTE IR FOR BOE-BOT W/TEXT
Manufacturer
Parallax Inc
Datasheets

Specifications of 28139

Accessory Type
IR Remote
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
Boe-Bot®
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
One non-spaghetti code way to implement the LAST/PREV CH button is by moving the
code block that sends pulses to the servos into a subroutine.
command can be used instead of a
code because the
follows the subroutine call.
Add this
Servo_Pulses:
Save KeypadDirectionDistanceYourTurn.bs2 as
KeypadDirectionDistanceYourTurn2.bs2.
Move the
that delivers the servo pulses from the main routine into a subroutine. It should
look like this when you are done.
' -----[ Subroutine - Servo_Pulses ]----------------------------------
' Call this subroutine to deliver pulses to the servos.
' You must store the number of pulses in the value variable
' and the maneuver in the direction variable.
' ChDn = backward, VolUp = rotate right, VolDn = rotate left.
Servo_Pulses:
DEBUG "The value is: ", DEC value, CR
DEBUG "Running...", CR, CR
Spaghetti Code Alert!
Using the
many instructors, computer programmers, robot design managers, and others. The reason
it is called "spaghetti code" is because of the difficulties you can encounter when trying to
find a mistake in a program with too many
program works becomes like trying to visually follow a single noodle through a plate of
spaghetti.
DEBUG "Running...", CR, CR
Servo_Pulses:
RETURN
Servo_Pulses:
GOTO
command to jump to a label elsewhere in a program is frowned upon by
command sends the program to the command that immediately
label between the two
GOTO
label, the
command.
DEBUG
GOTO
GOSUB
command, and the
commands. Understanding how the
DEBUG
' <--- Add this label.
tends not to cause spaghetti
ChUp = forward,
shown here:
That way, a
FOR…NEXT
GOSUB
loop

Related parts for 28139