Shop OBEX P1 Docs P2 Docs Learn Events
Linxmotion 4WD2 working using Basic Stamp BS2 — Parallax Forums

Linxmotion 4WD2 working using Basic Stamp BS2

lisandrolisandro Posts: 8
edited 2006-07-19 18:13 in BASIC Stamp
Im trying to make the linx 4dw2 work with the BS2, the 4dw2 comes with a scorpion board which i connected then to the BS2.

Any one can help to adjust the speed of the 4dw2, it uses DC motors, and i cant find the pulse needed to make them work properly with the sensors im using in the BS2.

Any sample code i can use would be a big help for me...

this the code im using right now, but the it moves really fast...

' Higher performance IR object detection assisted navigation
' {$STAMP BS2}
' {$PBASIC 2.5}
'
[noparse][[/noparse]Constants]
MotorR PIN 12 'Lefthand motor output.
MotorL PIN 13 'Righthand motor output.
'
[noparse][[/noparse]Variables]
irDetectLeft VAR Bit
irDetectRight VAR Bit
pulseLeft VAR Word
pulseRight VAR Word
'
[noparse][[/noparse]Main Program]
DO ' Main Routine
FREQOUT 8, 1, 38500 ' Check IR Detectors
irDetectLeft = IN9
FREQOUT 2, 1, 38500
irDetectRight = IN0
' Decide how to navigate.
IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN ' Backwards
pulseLeft = 750
pulseRight = 850
ELSEIF (irDetectLeft = 0) THEN ' Right Turn
pulseLeft = 650
pulseRight = 750
ELSEIF (irDetectRight = 0) THEN ' Left Turn
pulseLeft = 850
pulseRight = 750
ELSE ' Forward
pulseLeft = 1750
pulseRight = 1600
ENDIF
PULSOUT MotorL,pulseLeft ' Apply the pulse.
PULSOUT MotorR,pulseRight
PAUSE 15
LOOP ' Repeat main routine
Sign In or Register to comment.