View Single Post
  #5   Spotlight this post!  
Unread 18-02-2005, 11:27
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Joystick Button programming

Code:
 if (p1_sw_top ==1)
 {
 pwm01=200;
 }
That should work. Make sure nothing else is controlling pwm01 later, and that your motor is actually connected to a Victor on pwm01. If the Victor's light is flashing, there's a problem with the pwm cable. You can plug a servo directly onto the pwm pins to make sure the signal is getting out of the RC. Also, use the Dashboard program to make sure the top joystick button is being recognized by the OI.
Code:
 //Somewhere in the top of the file
 int output =0;
 
 //Down in the file
 output = p1_sw_top;
 if (output = 1)
 {
 pwm01=200;
 }
This will not work the way you intend, because you used a single equals sign in your if statement. That sets output to 1 every time, pwm01 will always be set to 200.