View Single Post
  #5   Spotlight this post!  
Unread 08-02-2006, 14:16
Matt Krass's Avatar
Matt Krass Matt Krass is offline
"Old" and Cranky. Get off my lawn!
AKA: Dark Ages
FRC #0263 (Sachem Aftershock)
Team Role: Mentor
 
Join Date: Oct 2002
Rookie Year: 2002
Location: Long Island, NY
Posts: 1,187
Matt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond repute
Send a message via AIM to Matt Krass
Re: Where is tank drive in 2005 code?

Be careful, it's very easy to accidentally make it multiply by 0, the PIC has no dedicated floating point processor and does weird things to decimals. It would make your motors constantly run full reverse. Which is also bad

I recommend multiplying up then dividing down. For example instead of

Code:
pwm01 = p1_y * 0.2; //Error Prone! BAD!
Use this

Code:
pwm01 = (unsigned int)(p1_y * 2) / 10;
Try them both on your calculator, you'll get the same result, but the PIC is more likely to work with the second method...practically guaranteed to work better than the first.

Good luck!
__________________
Matt Krass
If I suggest something to try and fix a problem, and you don't understand what I mean, please PM me!

I'm a FIRST relic of sorts, I remember when we used PBASIC and we got CH Flightsticks in the KoP. In my day we didn't have motorized carts, we pushed our robots uphill, both ways! (Houston 2003!)