Go to Post Either this entry is the winner or Andy needs professional help. I can't quite decide which... - Rich Kressly [more]
Home
Go Back   Chief Delphi > Technical > Programming
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
  #1   Spotlight this post!  
Unread 24-03-2005, 21:14
Joe Lewis Joe Lewis is offline
Registered User
#0992
 
Join Date: Mar 2005
Location: Sherman Oaks, CA
Posts: 2
Joe Lewis is an unknown quantity at this point
Change joystick to pwm mapping

We are trying to program the following scenario and are having a difficult time:

Joystick one - push forward - makes pwm11 go forward
Joystick one - pull back - makes pwm09 go forward
Joystick one - move left - make pwm05 go forward
Joystick one - move right - make pwm07 go foward

Each of the outputs needs to be variable, so the further the joystick is moved, the higher the output to the motors.

Lastly, if the joystick is moved forward, back, left or right off the x/y axis, then a combination of the motors needs to be triggered.

Can we do this, and if so, how? Below is a sample of my code that is not working. The code that I have is just triggering PWM01 to go forward or backward as the joystick is moved on the Y axis.

Thanks much,
Joe

pwm01 = pwm02 = pwm03 = pwm04 = pwm05 = pwm06 = pwm07 = pwm08 = 127;
pwm09 = pwm10 = pwm11 = pwm12 = pwm13 = pwm14 = pwm15 = pwm16 = 127;

/* Check if Port 1 Joystick is being pulled back or pushed forward */

if (p1_y <= 125) /* Joystick is being pulled back */
{
Pwm09 = 255 - p1_y; /* turn on motor 5 to go up */
Pwm11 = 127; /* turn off motor 6 */
}
else if (p1_y >= 135) /* Joystick is being pushed down */
{
Pwm11 = p1_y; /* turn on motor 6 to go down*/
Pwm09 = 127; /* turn off motor 5 */
}
else
{ /* In neither forward or reverse position */
Pwm11 = pwm09 = 127; /* Turn off motors 5 and 6 */
}
 


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
Compiling Failed Teh Mike Programming 7 09-02-2005 13:27
FYI about using PWM 13-16 with interrupts cabbagekid2 Programming 6 22-01-2005 00:54
pwm outputs vs. joystick y-axis stephenthe1 Programming 4 01-12-2004 17:29
heres the code. y this not working omega Programming 16 31-03-2004 15:18
Changing 1 joystick code to 2 (rookie team) Brawler006 Programming 5 20-02-2004 17:00


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

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