sorry im such a newb
and sorry for the long post
ok i got some code to debug and program
but its not right nothing happens when i use the controler
the analog light comes on the goes back off
i can push it again and it will stay on but neither way works
i tried the ps2 controller program for the motors but i can not connect to the controller in the terminal 1 tab in the tut it wants it on com1 but my bb2 is on com6 (usb adapter) and the only com it will let me select in the tab is com3 so im not shore whats going on there ether the controller
is a sony ps2 controller and works on a ps2 console
but for my brat ps2 program i have no clue about coding so i tried my best
to copy and paste and change things and write code and finaly got it to debug without error
so here is the code
[code]
; ------------------------------------------------------
; Lynxmotion Visual Sequencer SSC-32 ‘Export’ Program
; Sequencer SSC-32 project : mybot
; Date : 5/19/2009 8:34:01 PM
; ------------------------------------------------------
; Format : Basic Atom 24/28 IDE <= V02.2.1.1 or Pro IDE + SSC-32
; Original filename : mybot.bas
; Communication with SSC-32 : BotBoard V2 => Pin 08
; ------------------------------------------------------
Steps Wordtable $03DC, $0BE8, $1392, $83DC, $8BE8, $881F, $881F, |
$03C0, $0CC6, $1392, $838D, $8CB0, $881F, $881F, |
$044D, $8424, $801F, $801F, |
$0425, $0B0A, $1228, $841C, $8B1D, $881F, $881F, |
$0395, $8353, $801F, $801F, |
$0472, $0B0A, $1227, $845A, $8B1D, $881F, $881F, |
$03FA, $0CC6, $1392, $83ED, $8CB0, $881F, $881F, |
$0378, $8343, $801F, $801F, |
$0395, $0B0A, $1228, $8353, $8B1D, $881F, $881F, |
$03DC, $0BE8, $1392, $83DC, $8BE8, $881F, $881F, |
$0433, $0CF4, $1382, $83DE, $801F, $801F, |
$04E0, $0BA2, $842B, $801F, $801F, |
$8498, $801F, $801F, |
$0D48, $84A7, $801F, $801F, |
$03DC, $0BE8, $1392, $83DC, $801F, $801F, |
$03DC, $0BE8, $1392, $83DC, $8BE8, $881F, $881F, |
$03DA, $12B2, $83AE, $8AF3, $881F, $881F, |
$0396, $8353, $8C27, $881F, $881F, |
$033F, $001F, $001F, |
$0329, $8AA6, $881F, $881F, |
$03DC, $1392, $83DC, $8BE8, $881F, $881F, |
$02EB, $0BDD, $1366, $827A, $8BA8, $881F, $881F, |
$0322, $001F, $001F, |
$02EB, $001F, $001F, |
$02EB, $0001, $001F, |
$81EF, $8A23, $881F, $881F, |
$827A, $8BA8, $881F, $881F, |
$03DC, $0BE8, $1392, $83DC, $8BE8, $881F, $881F, |
$03DC, $0BE8, $1392, $83DC, $8BE8, $881F, $881F, |
$03DE, $0871, $10DD, $82E6, $8856, $881F, $881F, |
$0E7E, $081F, $081F, |
$03CF, $0F27, $1360, $83A0, $801F, $801F, |
$03DC, $0BE8, $1392, $83DC, $8BE8, $881F, $881F, |
$03DC, $0BE8, $1392, $83DC, $8BE8, $881F, $881F, |
$03DE, $09A7, $1535, $83DE, $8EA0, $881F, $881F, |
$0BE8, $8BE8, $881F, $881F, |
$03DC, $1392, $83DC, $801F, $801F, |
$83DC, $8001, $801F
SeqPos Wordtable $0000, |
$0007, |
$001D, |
$0036, |
$0055, |
$0074, |
$0093, |
$00B1, |
$00CB
;ps2 controler / botboard II
dat con p12
cmd con p13
sel con p14
clk con p15
SSC32 con p8
index var byte
temp var byte(19)
mode var byte
SeqIndex var word
LastServo var word
TmpServo var word
TmpValue var word
DejaVu var word
;ps2init
high clk
low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8,$43\8,$0\8,$1\8,$0\8] ;CONFIG_MODE_ENTER
high SEL
pause 1
low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$44\8,$00\8,$01\8,$03\8,$00\8,$00\8,$00\8,$00\8] ;SET_MODE_AND_LOCK
high SEL
pause 100
low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$4F\8,$00\8,$FF\8,$FF\8,$03\8,$00\8,$00\8,$00\8] ;SET_DS2_NATIVE_MODE
high SEL
pause 1
low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$4D\8,$00\8,$00\8,$01\8,$FF\8,$FF\8,$FF\8,$FF\8] ;VIBRATION_ENABLE
high SEL
pause 1
low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$43\8,$00\8,$00\8,$5A\8,$5A\8,$5A\8,$5A\8,$5A\8] ;CONFIG_MODE_EXIT_DS2_NATIVE
high SEL
pause 1
low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$43\8,$00\8,$00\8,$00\8,$00\8,$00\8,$00\8,$00\8] ;CONFIG_MODE_EXIT
high SEL
pause 1
main
;-----------PS2 Mode----------
low SEL
; asking “mode” to PS2 controller
shiftout CMD,CLK,FASTLSBPRE,$1\8]
; reading “mode” from PS2 controller
; 73(hex) is dualshock1 (digital buttons)
; 79(hex) is dualshock2 (analog buttons)
shiftin DAT,CLK,FASTLSBPOST,[mode\8]
high SEL
;-----------------------------
;pause 1
;-----------PS2 Data----------
low SEL
; asking data to PS2 controller
shiftout CMD,CLK,FASTLSBPRE,$1\8,$42\8]
; reading data from controller
; (don’t use a “for-next” loop, it’s too slow to read PS2 data)
shiftin DAT,CLK,FASTLSBPOST,[temp(0)\8,temp(1)\8,temp(2)\8,temp(3)\8,temp(4)\8,temp(5)\8,temp(6)\8,temp(7)\8,temp(8)\8, |
temp(9)\8,temp(10)\8,temp(11)\8,temp(12)\8,temp(13)\8,temp(14)\8,temp(15)\8,temp(16)\8,temp(17)\8,temp(18)\8]
high SEL
;-----------------------------
LastServo = 99
DejaVu = 0
pause 500
If temp(1) = 247 then
seqIndex = 0 ; rest home
Gosub PlaySeq
if temp(1) = 239 then
seqIndex = 1 ; Move forward
Gosub PlaySeq
If temp(1) = 191 then
seqIndex = 2 ; Move back
Gosub PlaySeq
If temp(1) = 127 then
seqIndex = 3 ; Move left
Gosub PlaySeq
If temp(1) = 223 then
seqIndex = 4 ; Move right
Gosub PlaySeq
endif
endif
endif
endif
endif
PlaySeq
for index = 1 to 7
For Index = SeqPos(SeqIndex) to SeqPos(SeqIndex + 1) - 1
TmpServo = Steps(Index) >> 11
TmpValue = Steps(Index) & 2047
if LastServo = TmpServo then
TmpValue = TmpValue << 5
if DejaVu then
Pause TmpValue
LastServo = 99
else
serout SSC32,i38400,“T”, DEC TmpValue, 13]
DejaVu = DejaVu ^ 1
endif
else
TmpValue = TmpValue + 500
serout SSC32,i38400,"#", DEC TmpServo, “P”, DEC TmpValue]
DejaVu = 0
LastServo = TmpServo
endif
next
next
goto main [/code]