Wireless controlled propeller
samsn4
Posts: 49
I know this should go in the completed projects, but i have posted on the Playstation thread before and did noit get an any replies, so . . . Here's the code i'm using, only this code, do i need a TV drive code or what? because when i try to compile it it gives me an error (see attached)
' {$STAMP BS2}
' {$PBASIC 2.5}
VAR
buff VAR Byte(6)
idx VAR Nib
idy VAR Nib
tmpout VAR Byte
PsxAtt PIN 9
PsxClk PIN 8
PsxCmd PIN 10
PsxDat PIN 11
Servo PIN 12 'assuming it is on pin 12
ServoPos VAR WORD
MAIN:
DO
GOSUB Get_PSX_Buttons
ServoPos =buff(4) * 2 + 500
ServoPos =ServoPos MIN 500
ServoPos =ServoPos MAX 1000
PULSOUT Servo, ServoPos
PAUSE 10 ' reduce or remove this pause if servo acts erratic
LOOP
'
[noparse][[/noparse] Subroutines ]
Get_PSX_Buttons:
DIR10=1
DIR11=0
High PsxClk ' Change this to low if you use the transistor
LOW PsxAtt
FOR idy = 0 TO 2
LOOKUP idy,[noparse][[/noparse]$01,$42,$00],tmpout
FOR idx=0 TO 7
PsxCmd=tmpout.LOWBIT(idx)
PULSOUT PsxClk,2
NEXT
NEXT
FOR idy = 0 TO 5
FOR idx=0 TO 7
tmpout.LOWBIT(idx)=PsxDat
PULSOUT PsxClk,2
NEXT
Buff(idy)=tmpout
NEXT
HIGH PsxAtt
RETURN
END
- - - - - - -EDIT - - - - - - - - -
Ok so just figured out it's Basic code so is any spin code for controlling with a Pelican wireless controller?
Post Edited (samsn4) : 11/15/2006 6:58:02 PM GMT
' {$STAMP BS2}
' {$PBASIC 2.5}
VAR
buff VAR Byte(6)
idx VAR Nib
idy VAR Nib
tmpout VAR Byte
PsxAtt PIN 9
PsxClk PIN 8
PsxCmd PIN 10
PsxDat PIN 11
Servo PIN 12 'assuming it is on pin 12
ServoPos VAR WORD
MAIN:
DO
GOSUB Get_PSX_Buttons
ServoPos =buff(4) * 2 + 500
ServoPos =ServoPos MIN 500
ServoPos =ServoPos MAX 1000
PULSOUT Servo, ServoPos
PAUSE 10 ' reduce or remove this pause if servo acts erratic
LOOP
'
[noparse][[/noparse] Subroutines ]
Get_PSX_Buttons:
DIR10=1
DIR11=0
High PsxClk ' Change this to low if you use the transistor
LOW PsxAtt
FOR idy = 0 TO 2
LOOKUP idy,[noparse][[/noparse]$01,$42,$00],tmpout
FOR idx=0 TO 7
PsxCmd=tmpout.LOWBIT(idx)
PULSOUT PsxClk,2
NEXT
NEXT
FOR idy = 0 TO 5
FOR idx=0 TO 7
tmpout.LOWBIT(idx)=PsxDat
PULSOUT PsxClk,2
NEXT
Buff(idy)=tmpout
NEXT
HIGH PsxAtt
RETURN
END
- - - - - - -EDIT - - - - - - - - -
Ok so just figured out it's Basic code so is any spin code for controlling with a Pelican wireless controller?
Post Edited (samsn4) : 11/15/2006 6:58:02 PM GMT
doc
80K
Comments
Am I seeing right ?, or you're trying to program the propeller with BS2 code ?
What's that ?
Alberto.
posted is the code from above, but in process of trying to be converted to spin.
Thanks
Post Edited (samsn4) : 11/17/2006 6:10:25 PM GMT
RoboGeek
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"I reject your reality and subsitute my own!"
Adam Savage, Mythbusters
www.parallax.com
www.goldmine-elec.com
www.expresspcb.com
www.startrek.com
·