Need a lil help brat with ssc-32 bb2 atom 28 pro and ps2

ok i have been playing with the code and i cant figure out what i need to do
when i run the program it only plays the “home” sequence" or "seqindex 0
if i hit the reset button on the bb2 while holding the stick in any direction it will play the sequence. but then i have to repeat to get it to do it again
below is the current code for the dualshock left analog stick

[code]for Index = 3 to 6
if DualShock(Index) > (128 + DeadZone) then
DualShock(Index) = DualShock(Index) - DeadZone/2
elseif DualShock(Index) < (128 - DeadZone)
DualShock(Index) = DualShock(Index) + DeadZone/2
else
DualShock(Index) = 128
endif
next

  	if DualShock(5) < 20 then    ; left Stick Horizontal
		SeqIndex = 3   ; turn left
		
   
	elseif DualShock(5) > 200 
		SeqIndex = 4   ; turn right
		
		
    elseif DualShock(6) < 20    ; left stick vertical
		SeqIndex = 1   ; forward
		
		
	elseif DualShock(6) > 200 
		SeqIndex = 2   ; backwords
	
	elseif DualShock(6) + Dualshock(5) = 128 
		SeqIndex = 0 ; home
	endif
  
gosub PlaySeq 

  endif[/code]

ok i read through the basic atom manual last night to see if i could figure out what is what in my code. i now have a better understanding of what the difrent parts of code are used for. im still not shore how to get my analog stick working the way it sould i tride using (do while) statments an
(while wend) statments but no luck. i must have somthing else wrong or missing somthing. im going to keep tryin to get it.
i dont want to feel like someones holding my hand anymore
i also downloded the powerpod software so i could study the code output from that as it will out put code to handal ps2 commands

all rite all rite check me out guys i got it working
:smiley:
what do you think

[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, $9419, $901F, $901F, |
$03C0, $0CC6, $1392, $838D, $8CB0, $9579, $901F, $901F, |
$044D, $8424, $801F, $801F, |
$0425, $0B0A, $1228, $841C, $8B1D, $9419, $901F, $901F, |
$0395, $8353, $801F, $801F, |
$03C0, $0CC6, $1392, $838D, $8CB0, $9579, $901F, $901F, |
$044D, $8424, $801F, $801F, |
$0395, $0B0A, $1228, $8353, $8B1D, $9419, $901F, $901F, |
$0472, $0B0A, $1227, $845A, $8B1D, $9419, $901F, $901F, |
$03FA, $0CC6, $1392, $83ED, $8CB0, $9579, $901F, $901F, |
$0378, $8343, $9578, $901F, $901F, |
$0395, $0B0A, $1228, $8353, $8B1D, $9419, $901F, $901F, |
$03DC, $0BE8, $1392, $83DC, $8BE8, $9419, $901F, $901F, |
$0433, $0CF4, $1382, $83DE, $94F2, $901F, $901F, |
$04E0, $0BA2, $842B, $801F, $801F, |
$8498, $801F, $801F, |
$0D48, $84A7, $801F, $801F, |
$03DC, $0BE8, $1392, $83DC, $9419, $901F, $901F, |
$03DC, $0BE8, $1392, $83DC, $8BE8, $9419, $901F, $901F, |
$03DA, $12B2, $83AE, $8AF3, $9429, $901F, $901F, |
$0396, $8353, $8C27, $881F, $881F, |
$033F, $001F, $001F, |
$0329, $8AA6, $881F, $881F, |
$03DC, $1392, $83DC, $8BE8, $9419, $901F, $901F, |
$02EB, $0BDD, $1366, $827A, $8BA8, $9442, $901F, $901F, |
$0322, $001F, $001F, |
$02EB, $001F, $001F, |
$02EB, $0001, $001F, |
$81EF, $8A23, $951B, $901F, $901F, |
$827A, $8BA8, $9442, $901F, $901F, |
$03DC, $0BE8, $1392, $83DC, $8BE8, $9419, $901F, $901F, |
$03DC, $0BE8, $1392, $83DC, $8BE8, $9419, $901F, $901F, |
$03DE, $0871, $10DD, $82E6, $8856, $95A0, $901F, $901F, |
$0E7E, $081F, $081F, |
$03CF, $0F27, $1360, $83A0, $93ED, $901F, $901F, |
$03DC, $0BE8, $1392, $83DC, $8BE8, $9419, $901F, $901F, |
$03DC, $0BE8, $1392, $83DC, $8BE8, $9419, $901F, $901F, |
$03DE, $09A7, $1535, $83DE, $8EA0, $925D, $901F, $901F, |
$0BE8, $8BE8, $881F, $881F, |
$03DC, $1392, $83DC, $9419, $901F, $901F, |
$9419, $9001, $901F

SeqPos Wordtable $0000, |
$0008, |
$0034, |
$0051, |
$0073, |
$0095, |
$00B8, |
$00DA, |
$00F7

SSC32 con p8

;PS2 Controller / BotBoard II (PS2 controller => pin 12, 13, 14, 15)
DAT con P12
CMD con P13
SEL con P14
CLK con P15

DeadZone con 28
PadMode con $79

;-------------Variables
DualShock var Byte(7)
DS2Mode var Byte
LastButton var Byte(2)

SeqIndex var Word
Index var Word
LastServo var Byte
TmpServo var Byte
TmpValue var Word
DejaVu var bit

LastServo = 99
DejaVu = 0

;-------------------------------------------------------------------------------------
; Main Loop
Main:

;-------------------------------------------------------------------------------------
; Query the current state of the PS2 buttons.
;Ps2Query
low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8]
shiftin DAT,CLK,FASTLSBPOST,[DS2Mode\8]
high SEL
pause 1

low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8,$42\8]
shiftin DAT,CLK,FASTLSBPOST,[DualShock(0)\8, DualShock(1)\8, DualShock(2)\8, DualShock(3)\8, |
DualShock(4)\8, DualShock(5)\8, DualShock(6)\8]
high SEL
pause 1

if DS2Mode <> PadMode then
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 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,$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,$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 288

  goto main

endif

;------------------------------------------------------------------------------------------------------------
; Now process the new PS2 input.
if (DualShock(2).bit3 = 0) and LastButton(1).bit3 then ;R1 Button test
;
elseif (DualShock(2).bit2 = 0) and LastButton(1).bit2 ;L1 Button test
;
elseif (DualShock(2).bit1 = 0) and LastButton(1).bit1 ;R2 Button test
;
elseif (DualShock(2).bit0 = 0) and LastButton(1).bit0 ;L2 Button test

elseif (DualShock(2).bit4 = 0) and LastButton(1).bit4 ;Triangle Button test

elseif (DualShock(2).bit6 = 0) and LastButton(1).bit6 ;Cross Button test

elseif (DualShock(2).bit7 = 0) and LastButton(1).bit7 ;Square Button test

elseif (DualShock(1).bit0 = 0) and LastButton(0).bit0 ;Select Button test

elseif (DualShock(1).bit3 = 0) and LastButton(0).bit3 ;Start Button test
seqIndex = 0 ; rest home
Gosub PlaySeq

elseif (DualShock(1).bit1 = 0) and LastButton(0).bit1 ;L3 Button test

elseif (DualShock(1).bit2 = 0) and LastButton(0).bit2 ;R3 Button test (Horn)

elseif (DualShock(1).bit4 = 0) and LastButton(0).bit4 ;Up Button test
seqIndex = 1 ; Move forward
Gosub PlaySeq

elseif (DualShock(1).bit6 = 0) and LastButton(0).bit6 ;Down Button test
seqIndex = 2 ; Move back
Gosub PlaySeq

elseif (DualShock(1).bit5 = 0) and LastButton(0).bit5 ;Right Button test
seqIndex = 4 ; Move right
Gosub PlaySeq
elseif (DualShock(1).bit7 = 0) and LastButton(0).bit7 ;Left Button test
seqIndex = 3 ; Move left
Gosub PlaySeq

else
; maybe process the 4 analog values from two joysticks

  for Index = 3 to 6
     if DualShock(Index) > (128 + DeadZone) then
        DualShock(Index) = DualShock(Index) - DeadZone/2
     elseif DualShock(Index) < (128 - DeadZone)
        DualShock(Index) = DualShock(Index) + DeadZone/2
     else
        DualShock(Index) = 128
     endif
  next

  if DualShock(5) < 20 then    ; left Stick Horizontal
		SeqIndex = 3   ; turn left
		Gosub PlaySeq
        
	elseif DualShock(5) > 200 
		SeqIndex = 4   ; turn right
		 Gosub PlaySeq
		
    elseif DualShock(6) < 20    ; left stick vertical
		SeqIndex = 1   ; forward
		Gosub PlaySeq
		
	elseif DualShock(6) > 200 
		SeqIndex = 2   ; backwords
	    Gosub PlaySeq
	elseif DualShock(6) + Dualshock(5) = 128 
		SeqIndex = 0 ; home
	endif

LastButton(0) = DualShock(1)
LastButton(1) = DualShock(2)
endif
goto main

PlaySeq:
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
return[/code]

update changede this line of code

     elseif DualShock(6) + Dualshock(5) = 128 
        SeqIndex = 0 ; home 
         Gosub PlaySeq 

to this

     elseif DualShock(6) and Dualshock(5) = 128 
        SeqIndex = 0 ; home 
         Gosub PlaySeq

Good job! I think you’re starting to get the hang of it already! :wink:

maybe but i still have a lot to learn am goin to keep reading my basic atom
syntax manual
thank you all for the guidance and holding my hand