Go to Post I did research before asking a question on CD..blasphemous I know - rachelholladay [more]
Home
Go Back   Chief Delphi > Technical > Control System
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Spotlight this post!  
Unread 08-02-2008, 04:59
RyanCahoon's Avatar
RyanCahoon RyanCahoon is offline
Disassembling my prior presumptions
FRC #0766 (M-A Bears)
Team Role: Engineer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Mountain View
Posts: 689
RyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond repute
Re: Joystick help (Rookie)

The following code will scale down your joystick sensitivity:

if your original code was

Code:
pwm01 = p1_y;
change it to:

Code:
pwm01 = ( ((signed int)p1_y) - 127 ) / 2 + 127;
Change pwm01 and/or p1_y according to which PWM output and joystick you are using. You can change the scaling factor by changing the 2 (right now it's set to 1/2). For example, to set it at 1/3 power, change the 2 to a three. If you want to use a fraction like 2/3, change / 2 to * 2 / 3. Note: use fractions this way and not decimals, as it will make your code run faster because it only does integer math.

Hope that wasn't too confusing,
--Ryan

Edit: That's for MPLAB. If you're using EasyC, I'm not sure if I can help as much.

Last edited by RyanCahoon : 08-02-2008 at 05:05. Reason: Sudden realization
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with joystick lightning_blast Programming 2 12-02-2006 22:25
Rookie help doyler Technical Discussion 55 11-01-2005 08:59
VB6: Joystick help! Astronouth7303 Programming 0 15-06-2004 17:05
Changing 1 joystick code to 2 (rookie team) Brawler006 Programming 5 20-02-2004 17:00
Joystick Help archiver 2001 0 24-06-2002 01:02


All times are GMT -5. The time now is 16:16.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi