PDA

View Full Version : Wireless controlled propeller



samsn4
11-16-2006, 01:43 AM
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
' -----[ 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,[$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

BTX
11-16-2006, 07:26 AM
Sorry samsn4.
Am I seeing right ?, or you're trying to program the propeller with BS2 code ?
What's that ?

Alberto.

samsn4
11-18-2006, 01:05 AM
yeah i noticed that, so is there are way to convert the code to spin or is there SPIN code for the pelican wireless, cause all i see is basic code.

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

MacGeek117
11-20-2006, 04:43 AM
I would suggest reading through the Propeller Manual, especially chapter 3. It will give you lots of help.
RoboGeek

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"I reject your reality and subsitute my own!"

Adam Savage, Mythbusters
www.parallax.com (http://www.parallax.com/)
www.goldmine-elec.com (http://www.goldmine-elec.com)
www.expresspcb.com (http://www.expresspcb.com)
www.startrek.com (http://www.startrek.com)