|
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!)
|