Download Print this page

Parallax 29115 Manual page 12

Line follower module

Advertisement

Listing 2
' -----[ Title ]----------------------------------------------------------------
'
' File...... LF_SIMPLE.BS2
' Purpose... Simple Line Follower
' Author.... Parallax
' E-mail.... stamptech@parallaxinc.com
' { $STAMP BS2 }
' -----[ Program Description ]--------------------------------------------------
'
' This program uses a very simple approach to follow a thin black line on
' a white field.
A test track can be created using a large sheet of white
' construction paper and a wide-tipped black marking pen.
' should be just as wide as one sensing element.
' -----[ Revision History ]-----------------------------------------------------
'
' 01 DEC 2001 - Version 1.0
' -----[ I/O Definitions ]------------------------------------------------------
'
LMotor
CON
RMotor
CON
' -----[ Constants ]------------------------------------------------------------
'
LEDon
CON
LEDoff
CON
WLine
CON
BLine
CON
LFmode
CON
MStop
CON
Speed100
CON
Speed075
CON
Speed050
CON
' -----[ Variables ]------------------------------------------------------------
'
ledPos
VAR
lfBits
VAR
lastBits
VAR
steer
VAR
' -----[ EEPROM Data ]----------------------------------------------------------
'
' -----[ Initialization ]-------------------------------------------------------
'
Initialize:
OutL = %01111100
DirL = %01111100
Parallax, Inc. • Parallax Line Follower (#29115) • 12/2001
15
14
0
1
0
1
BLine
750
125
50
40
Nib
Byte
Byte
Nib
The line width
' servo motor connections
' LF LEDs are active low
' white line on black field
' black line on white field
' set for black line
' motor stop
' full speed
' three-quarter speed
' half speed
' LED position in lfBits
' line follower reading
' previous reading
' steering control
' all LF LEDs off
' make pins outputs
Page 11

Advertisement

loading