29122 Parallax Inc, 29122 Datasheet - Page 8

KIT PARTS IR REMOTE FOR BOE-BOT

29122

Manufacturer Part Number
29122
Description
KIT PARTS IR REMOTE FOR BOE-BOT
Manufacturer
Parallax Inc
Datasheet

Specifications of 29122

Accessory Type
IR Remote
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
BASIC Stamp 2 Series Example - Multi-Digit Application
You can use the remote for keypad entry of values by replacing the DO…LOOP in
IrRemoteButtonDisplay.bs2's main routine one shown below. It works for values from 0 to 65535; just
type in the value on the digital keypad, then press the remote's ENTER key.
Page 8 of 10
#ENDSELECT
' Map digit keys to actual values.
IF (remoteCode < 10) THEN remoteCode = remoteCode + 1
IF (remoteCode = 10) THEN remoteCode = 0
RETURN
#CASE #ELSE
PULSIN IrDet, 0, irPulse
IF irPulse > ThresholdPulse THEN remoteCode.BIT0 = 1
PULSIN IrDet, 0, irPulse
IF irPulse > ThresholdPulse THEN remoteCode.BIT1 = 1
PULSIN IrDet, 0, irPulse
IF irPulse > ThresholdPulse THEN remoteCode.BIT2 = 1
PULSIN IrDet, 0, irPulse
IF irPulse > ThresholdPulse THEN remoteCode.BIT3 = 1
PULSIN IrDet, 0, irPulse
IF irPulse > ThresholdPulse THEN remoteCode.BIT4 = 1
PULSIN IrDet, 0, irPulse
IF irPulse > ThresholdPulse THEN remoteCode.BIT5 = 1
PULSIN IrDet, 0, irPulse
IF irPulse > ThresholdPulse THEN remoteCode.BIT6 = 1
#ERROR "BASIC Stamp version not supported by this program."
Add this declaration to the IrRemoteButtonDisplay.bs2's Variables section:
Replace the DO…LOOP in IrRemoteButtonDisplay.bs2's main routine with the one shown below.
Run the program and follow the Debug Terminal's prompts.
' Replace the DO...LOOP in the Main Routine with this one for multi-digit
' value acquisition (up to 65535). Value stored in value variable.
DEBUG CR, CR, "Type value from", CR, "0 to 65535,", CR,
DO
value = 0
remoteCode = 0
DO
value
value = value * 10 + remoteCode
DO
"then press ENTER", CR, CR
GOSUB Get_Ir_Remote_Code
IF (remoteCode > 9) AND (remoteCode <> Enter) THEN
VAR
Word
© 2004 Parallax Inc. • IR Remote AppKit (#29122) • 10/2004
' Get data pulses.
' Stores multi-digit value

Related parts for 29122