View Single Post
  #7   Spotlight this post!  
Unread 17-10-2004, 12:56
MikeDubreuil's Avatar
MikeDubreuil MikeDubreuil is offline
Carpe diem
FRC #0125 (Nu-Trons)
Team Role: Engineer
 
Join Date: Jan 2003
Rookie Year: 1999
Location: Boston, MA
Posts: 967
MikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond reputeMikeDubreuil has a reputation beyond repute
Send a message via AIM to MikeDubreuil
Re: Create a low speed drive in programming

The wheel that John is talking about was on the old joysticks. It was a thumb wheel located opposite the y axis trim adjustment wheel. The input was analog and reffered to in the code with a variable name similar to "thumb_wheel."

Here's the code to have the thumb wheel control the scaling on a joystick input.

Code:
if (joystick < 127) {
     motor = 127 - ((127 - joystick) * (thumb_wheel/254));
} else if (joystick > 127) {
     motor = 127 + ((joystick - 127) * (thumb_wheel/254));
}
__________________
"FIRST is like bling bling for the brain." - Woodie Flowers