Shop OBEX P1 Docs P2 Docs Learn Events
Basic Stamp + Pixy CMUcam — Parallax Forums

Basic Stamp + Pixy CMUcam

I am a green hand and doing a tracking robot using Pixy and basic stamp. now I can only get the Pan and Tilt value for the camera, and I wrote codes for my robot.(see below) The code doesn't work at all, can anyone help me? I would really appreciate that. Thanks!

' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG CLS, "Program Running!!!"

'
[ Variables ]
wheelL VAR Word 'pin15 - L
wheelR VAR Word 'pin14 - R
pan VAR Word 'pin10
tilt VAR Word 'pin11
size VAR Word
followError VAR Word
forwardSpeed VAR Word
differential VAR Word
Center_Pos CON 750

'
[ Initialization ]
FREQOUT 4,2000,3000 'signal program start/reset

'
[ Main Routine ]
DO
PULSIN 10,1,pan
PULSIN 11,1,tilt
DEBUG "pan=",DEC pan," tilt=",DEC tilt,CR

followError = Center_Pos - pan
size = tilt
size = size - size/6

IF(size>700)AND(size<850)THEN forwardSpeed1
IF(size<700)THEN forwardSpeed2
IF(size>850)THEN forwardSpeed3

differential = (followError + (followError*forwardSpeed))/1000

wheelL=forwardSpeed + differential
wheelR=forwardSpeed - differential

PULSOUT 15,wheelL
PULSOUT 14,wheelR
LOOP

forwardSpeed1:
forwardSpeed=850 - size/8
RETURN

forwardSpeed2:
forwardSpeed=700
RETURN

forwardSpeed3:
forwardSpeed=850
RETURN

Comments

  • Here are links to a couple of threads about pixy.
    https://www.google.com/url?q=http://forums.parallax.com/discussion/156379/pixy5-compatibility-with-basic-stamp-boe-bot&sa=U&ved=0ahUKEwikh5-3rIzMAhVLyGMKHVXABTEQFggOMAM&client=internal-uds-cse&usg=AFQjCNGyuLvDWlpQ-baGTJVe_pTSvsVs8A
    
    https://www.google.com/url?q=http://forums.parallax.com/discussion/155501/pixy-for-propeller&sa=U&ved=0ahUKEwikh5-3rIzMAhVLyGMKHVXABTEQFggFMAA&client=internal-uds-cse&usg=AFQjCNHV3LyKen0lQXzKnuNsFa0d3xFzQQ
    

    The bottom line seems to be that propellor is a better match for pixy.
Sign In or Register to comment.