Lynxmotion Tech Support

www.lynxmotion.com
It is currently Fri May 24, 2013 9:52 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Tue Mar 15, 2011 5:47 pm 
Offline
Roboteer

Joined: Thu Mar 10, 2011 5:16 pm
Posts: 23
This is for the regional science fair tomorrow. Helllllllllllllllp!!!!


Top
 Profile  
 
PostPosted: Tue Mar 15, 2011 6:58 pm 
Offline
Robot Guru
User avatar

Joined: Sat Apr 15, 2006 1:42 pm
Posts: 4414
I don't know from your last couple of posts what your complete code is, but here are a couple of pointers...

The array temp, was used to read in the current values of the PS2, the array indexes 3-6 are for the two joysticks. They are unsigned byte values, which implies that they have a value from 0-255. So for whatever reason you appear to be adding 255 these values so for example
lvert will always have a value from 255 to 511 so you will always be adding. You should probably do something like:
Code:
lvert = temp(6) -128


But you have an additional problem in that lver is defined as a word, which is unsigned (range 0-65535). You probably want to define it as SWORD which is signed.

Next I don't know what you do after issuing the hservo commands. Do you simply jump back up to main, which starts the next read of the PS2, calculates and reissue the HSERVO? If so suppose it can complete this loop in lets say .025 seconds. If you move the joystick up to the top and lets say you add on an average of 500 units with your current code, you have 12000/500 or 24 cycles through the loop before you hit your max value, so 24*.025 or about .6 seconds before you hit full speed. My guess is that the loop may take less time than that so you can see you hit max speed really quick.

What some do is do a pause of some time after the hservo command to give it some time to do stuff. Or when the are ready to output the next command, the do a loop to query the servos of the previous move to see if they complete the previous move...

Kurt


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

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