View Single Post
  #8   Spotlight this post!  
Unread 15-02-2006, 18:17
Inverted Inverted is offline
Registered User
AKA: Eric P.
FRC #1228 (Robo Tribe)
Team Role: College Student
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Rahway, NJ
Posts: 25
Inverted is an unknown quantity at this point
Send a message via AIM to Inverted
Re: Control Problems

Quote:
Originally Posted by hoag
If anything is moving in the wrong direction, you could just subtract the Limit_Mix result from 254. (To reverse direction)

for the right motor I use
(254-(Limit_Mix(2000 + p1_y + p1_x - 127)));


for the left motor I use
(Limit_Mix(2000 + p1_y - p1_x + 127));


I've used this setup for all of my team's robots.
Just tried it, and that works for me, too. Thanks a lot!

One more quick question. We have a motor on the bot that we don't need on all the time, just to save battery power. I wired a toggle switch so that when it's turned on, it shows up as the trigger button of a joystick being held on. Is there any way I can set a PWM to be equal to the y-axis of a joystick, ONLY when the switch is on, and then neutral when it's off? Here's the idea I had:
Code:
int my_y;

pwm02 = my_y;
if (p3_sw_trig==1){
 my_y = p2_y;
}
else {
 my_y == 127;
}
Chances are it's completely wrong, but...