View Single Post
  #4   Spotlight this post!  
Unread 30-01-2006, 21:00
Manoel's Avatar
Manoel Manoel is offline
Registered User
FRC #0383 (Brazilian Machine)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 2000
Location: Porto Alegre, RS, Brazil
Posts: 608
Manoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond repute
Send a message via ICQ to Manoel Send a message via MSN to Manoel
Re: Using a switch with a victor

Try something like this:

pwm01 = 127 + (p1_sw_trig*127) - (p1_sw_top*127);

That way, if p1_sw_trig is pressed, the motor will be full forward (254). If p1_sw_top is pressed, it will go full reverse (0). If by mistake you press both buttons, nothing happens - safe!

Gotta love one liners
__________________
Manoel Flores da Cunha
Mentor
Brazilian Machine
Team # 383