Lynxmotion Tech Support

www.lynxmotion.com
It is currently Mon May 20, 2013 3:37 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 33 posts ]  Go to page Previous  1, 2, 3
Author Message
PostPosted: Sun Jun 13, 2010 10:59 am 
Offline
Robot Guru
User avatar

Joined: Sat Apr 15, 2006 1:42 pm
Posts: 4414
So for the fun of it, I edited the simple PS2 test program with a few different #ifdefs. One to define it for the standard pins or for having it on pins 0-3. Another to decide if you want all 18 bytes/vibration or if you simply want the standard 6 bytes all of our programs typically use, and last and hopefully not least, will use the code I mentioned in the previous post:
Code:
      IF ABS(Dualshock(5) - 128) > DeadZone THEN ;Left Stick L/R
         LStickY = (Dualshock(5) - 128) ;Wheels
      ELSE
         LStickY=0       
      ENDIF
 

To map the joystick values from the center point and print them. Have fun!

Kurt

Edit: as an added bonus, I put in some simple pan/tilt code on the left joystick that you can ifdef in or out. You will have to change the IO pins that they are on. The tilt works fine, but I am having problems with my Pan servo in a base rotate unit that I need to replace...


Attachments:
File comment: More test stuff!
test.bas [5.67 KiB]
Downloaded 76 times
Top
 Profile  
 
PostPosted: Tue Jun 15, 2010 6:02 pm 
Offline
Robot Guru
User avatar

Joined: Sun Aug 27, 2006 11:26 pm
Posts: 2757
Location: Directly above the center of the Earth
kurte wrote:
Edit: as an added bonus, I put in some simple pan/tilt code on the left joystick that you can ifdef in or out. You will have to change the IO pins that they are on. The tilt works fine, but I am having problems with my Pan servo in a base rotate unit that I need to replace...

I just tried your new code. It does work for positioning the Pan servo. I have to install a servo for the Tilt, so have not checked that yet. Is there any way to get the sticks to auto center when they are not being operated? That does not seem to be happening now.

8-Dale

_________________
I can usually handle complexity. It's the simple things that always confound me..
Open your mind, Read, Learn, Think, Apply..


Top
 Profile  
 
PostPosted: Fri Jun 18, 2010 2:57 pm 
Offline
Robot Guru
User avatar

Joined: Sat Apr 15, 2006 1:42 pm
Posts: 4414
linuxguy wrote:
I just tried your new code. It does work for positioning the Pan servo. I have to install a servo for the Tilt, so have not checked that yet. Is there any way to get the sticks to auto center when they are not being operated? That does not seem to be happening now.

If what you desire is for the pan and tilt to mimic the position of the joystick, then you can simplify the code. That is instead of looking at the current position, you simply scale the Joystick return values. That is you could do something like:
Code:
IF (ABS(DualShock(3)-128) > TravelDeadZone) THEN
    hservo [Turret\(Dualshock(3) - 128)*4) \100]
ELSE
    hservo [Turret\0 \100]
ENDIF

Personally I don't think this will work very well, as the joystick return values are not fluid.

Other options:
1) TImeout - if the joystick has been at the center position for a certain amount of time, set it to zero point.

2) use a button like: clicking the joystick to say Move me back to the idle position.

Kurt


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 33 posts ]  Go to page Previous  1, 2, 3

All times are UTC - 6 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:  
Powered by phpBB® Forum Software © phpBB Group