8
Parallax, Inc.
•
Boe-Bot Tank Tread Kit (#28106)
03/2004
Stamp Code
' =========================================================================
'
' File...... Advanced_Tank_Bot.BS2
' Purpose... Tank Bot with Tilt Sensing
' Author.... Parallax
' E-mail.... support@parallax.com
' Started...
' Updated... 12 APRIL 2004
'
' {$STAMP BS2}
' {$PBASIC 2.5}
'
' =========================================================================
' -----[ Program Description ]---------------------------------------------
'
' This program incorporates the Memsic 2125 accelerometer into the BOE-Bot
' tank kit to allow the tank to exlore uneven terrain without tipping over.
' -----[ Revision History ]------------------------------------------------
' -----[ I/O Definitions ]-------------------------------------------------
LfIrOut PIN 8 ' left IR LED output
LfIrIn PIN 9 ' left IR sensor input
RtIrOut PIN 1 ' right IR LED output
RtIrIn PIN 0 ' right IR sensor input
LMotor PIN 13 ' left servo motor
RMotor PIN 12 ' right servo motor
TiltX PIN 4 ' X tilt input
TiltY PIN 5 ' Y tilt input
' -----[ Constants ]-------------------------------------------------------
LFwd CON 1000 ' left motor forward
LStop CON 750 ' left motor stop
LRev CON 500 ' left motor reverse
RFwd CON 500 ' right motor forward
RStop CON 750 ' right motor stop
RRev CON 1000 ' right motor reverse
IsHigh CON 1 ' high-going pulse
IsLow CON 0 ' low-going pulse
YThresh CON 20 ' Y tilt threshold
' -----[ Variables ]-------------------------------------------------------
pulses VAR Byte ' counter for servo control