|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: please explain more...
Posted by Jerry Eckert.
Engineer from Looking for a team in Raleigh, NC sponsored by . Posted on 3/15/2000 8:48 PM MST In Reply to: Re: please explain more... posted by Nate Smith on 3/15/2000 6:09 PM MST: : As for losing part of our range, when I attempted to scale down the drive train output to 50% of the joystick value in order to create our 'turbo boost' function, using the code shown below: : (for forward) : p1_yfilt = (p1_yfilt)/2 min 128 max 254 : (for reverse) : p1_yfilt = (p1_yfilt*3)/2 min 0 max 126 : in one direction, i would lose all output unless the 'turbo' function was on, and in the other, it would always act as if the turbo was turned on. I don't have the PBASIC manual handy, but it looks like the problem might be that the precedence of min/max is higher than division. In other words, I suspect PBASIC evaluated your statements as: p1_yfilt = (p1_yfilt)/(2 min 128 max 254), and p1_yfilt = (p1_yfilt*3)/(2 min 0 max 126) Try rewriting them as follows: p1_yfilt = (p1_yfilt/2) min 128 max 254, and p1_yfilt = ((p1_yfilt*3)/2) min 0 max 126 Jerry |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Battlebots I.Q.- A serious threat to FIRST or a half thought up cheep copy? | Joe Matt | General Forum | 75 | 17-10-2005 20:43 |
| Fried program slots? | Jeff Waegelin | Programming | 18 | 19-03-2003 18:08 |
| Anyone looking for more program space? | archiver | 2001 | 13 | 24-06-2002 02:20 |
| robot control emulator for default or other program | CharlieWilken | Programming | 26 | 24-02-2002 02:36 |
| control program looping??? | ctartist236 | Programming | 1 | 08-02-2002 10:09 |