PS2 viberation not working

Yes!! For once i’m not going insane! (i’ve tried alot of things)

I’ll be looking forward to your research. :smiley:

bane

Hello Bane,

I have tried all code modifications i can think of…with no positive result :cry:
sorry for this issue :unamused: :blush:

Hmm, thats interesting :confused: . Do you know if enabling the viberation motors is even possible with the lynxmotion controller? Just out of curiosity, was this tutorial ever done by anyone else that had trouble. I find this odd being that all the other tutorials haven’t gave me any trouble :frowning: .

Bane

This remains a mystery to me. Both Laurent and I thought this worked in the past. It’s possible that the second batch of controllers we received didn’t have this feature, but it’s really difficult to nail down. We are still working on it.

Are there any modifications made to this controller?

bane

No modifications, it’s a genuine imitation PS2 games controller. 8)

Do you mean that you made the tutorial on a different brand controller? If so…that sux, i had a great idea for a robot.
:cry:
Bane

Yes the original code was written for the MadCatz controller and also verified with the Sony brand one. I am working with the mfg to get some help. I don’t know if we will be successful but we are trying.

Sony will never release any code examples for the controllers. All of the code commands we are using were found on the internet a long time ago. They were posted by people who have attempted to reverse engineer it. We continue to fine tune and further modified the code to fix inaccuracies.

Because the motors work on the PS2 console then it’s just a matter of fine tuning our code to make it work. This is easier said then done.

any luck?

is there anything i can do to help?

Bane

Nothing yet. With the language barrier, the competition, the Sony factor… I will prod them again.

question: why do you have the green connected to VS in this picture? http://www.lynxmotion.com/images/assembly/eh3rv2/big/eh3r12b.jpg

Can i get a controller that will work or should i hunt for one of those good old controlles :wink: .

Bane

The green wire is used on some controllers for the vibrating motors. However on the Lynxmotion ones the wire is not used.

Over the week end i got the viberation motors to work with this code:

However, i can’t get control of any bottons or the d pad. Only have limited control of right and left joys.

[code]DAT con P4
CMD con P5
CLK con P7
SEL con P6

temp1 var byte
index var byte
temp var byte(21)
cntr var byte
mode var byte

small var byte
large var byte

high CLK

low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8,$43\8,$0\8,$1\8,$0\8] ;Config Enable
high SEL

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 Fix(Analog
high SEL

pause 100

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

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 Exit
high SEL

main

low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8]
shiftin DAT,CLK,FASTLSBPOST,[mode\8]
high SEL

low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8,$42\8]
for index = 0 to 2
shiftin DAT,CLK,FASTLSBPOST,[temp(index)\8]
next
high SEL

low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8,$42\8,$0\8,large\8,small\8]
for index = 3 to 6
shiftin DAT,CLK,FASTLSBPOST,[temp(index)\8]
next
high SEL

serout S_OUT,i57600,[13,hex2 mode\2]
for index = 1 to 6
serout S_OUT,i57600," ",dec3 temp(index)\3]
next

small = temp(7)
large = temp(8)
goto main[/code]

please help, i’ve tried a lot of things and i just can’t seem to get viberation and full control all at once!

Bane

I asked Laurent to look at your code to see if you may have found something here.

Hey Bane ! you found something,

using “old” PS2 DualShock 1 mode ($73) makes the Lynxmotion Pad to be able to vibrate :stuck_out_tongue: .

so, here’s some explanations about your program which was not working :

  • Temp( 7 ) and temp( 8 ) were not read, so they were filled with random values
  • using for-next loop is too slow to read PS2 flow, so we must read all data within a line
  • “large” and “small” variables were inverted in the “shiftout” line, the first one to be sent is “small” then “large”

some pauses are added
temp array is reduced to 7 bytes
temp1 and cntr variables deleted

please note :
using DS1 mode ($73), all buttons are numeric, no more analog.
so here’s the corrected code (SEL and CLK lines were swapped to see pin assignment incremental)

Thanks for your help solving this :wink:

[code]; PS2 Controller Program for BB1/BB2
; PS2 mode $73, Dualshock 1 mode, compatible with DS1 and DS2 PAD
; 16 numeric buttons and 2 X 2 axis analog joysticks
; vibration compatible with PS2 Lynxmotion controller
;
; push right arrow to enable the small vibration motor (only “on” or “off”)
;
; push left arrow to allow the large vibration motor, keep pressed
; then move the right joystick vertically to control the large motor speed

;BotBoard I
DAT con P4
CMD con P5
SEL con P6
CLK con P7

; BotBoard II
;DAT con P12
;CMD con P13
;SEL con P14
;CLK con P15

index var byte
temp var byte(7)
mode var byte

small var byte
large var byte

high CLK

low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8,$43\8,$0\8,$1\8,$0\8] ;Config Enable
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 Fix(Analog
high SEL
pause 100

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,$00\8,$00\8,$00\8,$00\8,$00\8] ;Config Exit
high SEL
pause 1

main

low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8]
shiftin DAT,CLK,FASTLSBPOST,[mode\8]
high SEL

low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8,$42\8]
shiftin DAT,CLK,FASTLSBPOST,[temp(0)\8,temp(1)\8,temp(2)\8]
high SEL

low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8,$42\8,$0\8,small\8,large\8]
shiftin DAT,CLK,FASTLSBPOST,[temp(3)\8,temp(4)\8,temp(5)\8,temp(6)\8]
high SEL

serout S_OUT,i57600,[13,hex2 mode\2]
for index = 1 to 6
serout S_OUT,i57600," ",dec3 temp(index)\3]
next

small = 1 - temp(1).bit5
if temp(1).bit7 then
Large = 0
else
large = 255 - temp(4)
endif

goto main[/code]

Yes! It’s about time things start working on my project :smiley: .

Are you saying that its not possable to have temp array to 19 bytes (full capasity of controller)?

If not, can i just make the modification to the code that the viberation doesn’t work on?

Thanks for helping me out on this, i spent quite a bit of time fooling around with the code (with no clue what i’m doing :imp: ), I’m still a noob at all this advanced basic coding.

Bane

I think he just reduced it to the minimum required for the purpose. You can increase it if necessary.

Bytes 8 to 19 were analog buttons positions…as Dualshock 1 mode ($73)
doesn’t handle analog buttons you just need 7 bytes.

DS1 mode uses 16 numeric buttons and 2 X 2 axis analog joysticks

using DS2 mode ($79 as before) will allow analog buttons but will not allow the vibration on the Lynxmotion PS2 Pad.

Anyway, none of the projects is using analog buttons for now.

Laureatus, have you ever had a problem with the PS2 data repeating commands? Thats what mine is doing, heres an example:

[code]…
IF temp(8) <128 then
goto walkforward
elseif temp(8) > 128
goto walkbackward
endif

[/code]
What will happen is then temp(8) meets one of those conditions it repeats the what ever is after the condition twice.

Any Ideas?

Bane

I’m not sure to understand,

if you mean your robot is performing “walkforward” and “walkbackward” at the same time…

it’s false…and true :wink:
let me explain,
it’s false in the fact that your code is correct, so it can’t perform both “goto” in the same loop.
So, looking at this small part of code we could think all is correct.

But :

Your program is looping on itself i suppose, so this code is called many times per second, this is where problems starts.

the PS2 controller is not so accurate, it goes both side of the 128 value many times per seconds even if you don’t move it :confused:
so it’s true in the fact that both “goto” are called within a second, each different one in a different “main” loop.

that’s why you should add a “Deadzone” 8)

in fact you already have programmed a “Deadzone”, because if the value is 128, none of the “goto” are called because you are using “> 128” and “< 128” (strictly < or >), but this is too small range.

try this :

IF temp(8) < 115 then goto walkforward elseif temp(8) > 141 goto walkbackward endif

now the “Deadzone” width is 27 values, this is a good range for most of the controllers