Lynxmotion Tech Support
Join the Accelerator Program
It is currently Thu Apr 24, 2014 4:23 am

All times are UTC - 5 hours [ DST ]

Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Mon Mar 01, 2010 1:21 pm 

Joined: Thu Dec 18, 2008 11:43 pm
Posts: 6
It seems that there are some in this Playstation 2 Forum and the SEQ Forum that have complained about repeating sequences or subprograms when a button on the Playstation 2 controller pushed.
I was in the same boat. Every time I pushed a button on my Platstation controller, it would play that sequence, (or now in my case, subprogram) twice. It was driving me crazy!
Well, it seems to be that the program for the controller is TOO fast. And everytime a button is pushed, the index that the variable is stored in, seems to stay even through the next loop around (if that makes any since). In other words, you can't release the button fast enough before the program comes back around, which then plays that sequence again.

There is a Pause 1 on the end of the PS2 subprogram before my button assignments, so I made that a pause 200 and that seem to do the trick for me! In other words, it slowed the program down so I had enough time to take my finger off the button!

Now I don't know if this will work for the SEQ sequences, it should, but not sure. There was talk before about running the sequence only once (in the SEQ forum) and how to do that, which I did, but it still played a sequence at least twice. Here is my program I'm running for my little humanoid:

main program.bas [5.08 KiB]
Downloaded 72 times

I hope this helps anybody who was having this problem. And if anybody has any suggestions that would make it better or more efficient please let me know.
I'm all about learning and keeping an open mind!


PostPosted: Mon Mar 01, 2010 6:22 pm 
User avatar

Joined: Sun Feb 08, 2009 8:50 pm
Posts: 93
Location: Mesa, AZ
I have encountered that as well. Good fix! Thanks!!
Can you post your whole program? Where are the walking sequences?

PostPosted: Mon Mar 01, 2010 8:18 pm 
Robot Guru
User avatar

Joined: Sat Apr 15, 2006 2:42 pm
Posts: 4755
Hi Anthony,

Looks good :)

Another approach is to remember the last state of the buttons and only perform the action if the new state is logically down and the previous state was not...

For example if you look at the PS2 code that is part of the phoenix you will see something like:
  low PS2SEL
  shiftout PS2CMD,PS2CLK,FASTLSBPRE,[$1\8,$42\8]   
  shiftin PS2DAT,PS2CLK,FASTLSBPOST,[DualShock(0)\8, DualShock(1)\8, DualShock(2)\8, DualShock(3)\8, |
     DualShock(4)\8, DualShock(5)\8, DualShock(6)\8]
  high PS2SEL
  pause 10   
  ; Switch bot on/off
  IF (DualShock(1).bit3 = 0) and LastButton(0).bit3 THEN   ;Start Button test

   ... end of function. 
  ;Store previous state
  LastButton(0) = DualShock(1)
  LastButton(1) = DualShock(2)

In this code he is checking the start button and if it is now 0 (pressed down) and the previous one is 1 then he does the action

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
© 2014 RobotShop Distribution inc. All rights reserved.
Powered by phpBB® Forum Software © phpBB Group