|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Programming joysticks
Because the last bits are unreliable (from what i've read), how will this affect the program? Should I stick with a general area? example:
Code:
if (p1_wheel >= 42 && p1_wheel <= 46)
// I am neutral
if (p1_wheel >= 250 && p1_wheel <= 254)
// I am upperleft;
|
|
#2
|
|||||
|
|||||
|
Re: Programming joysticks
Quote:
|
|
#3
|
||||
|
||||
|
Re: Programming joysticks
Quote:
|
|
#4
|
|||
|
|||
|
Do you know the non-binary values of the pX_wheel in their up- and down positions?
I am trying to use their values with a pwm and do not know what to use. Quote:
|
|
#5
|
||||
|
||||
|
Re: Programming joysticks
Quote:
![]() |
|
#6
|
|||
|
|||
|
Re: Programming joysticks
If u can make me a favor, can u teach me how to program the joysticks. I will appreciated. thank u
GOOD LUCK THIS YEAR |
|
#7
|
||||
|
||||
|
Re: Programming joysticks
the inputs from the joysticks are held in a range of variables (actually aliases), set up in ifi_aliases.h:
for instance, the x-axis of joystick one is p1_x if you want direct joystick-to-pwm control, just use something like the following line: pwm01 = p1_x; |
|
#8
|
||||
|
||||
|
Re: Programming joysticks
Quote:
The value that comes in on these pins is between 0 and 255 (an unsigned char). 0 is full to one side, 127 is center, and 255 is full to the other side. For instance, if you have the joystick all the way forward, p1_x would be 255 and p1_y would be 127. If you had it all the way to the right, p1_y would be 127 and p1_y would be 255. You could also have a combination of the two, of course. For instance, if you where in the forward, right corner, you would get p1_x and p1_y both reading 255. You can use these values in any way in your program. Just don't try to change their value in code; it won't work! Hope that helps. Good luck. |
|
#9
|
|||
|
|||
|
Re: Programming joysticks
hey, i have a question
we plugged a motor to the pwn port that corresponds to p1_wheel(the wheel) and teh operator interface shows that when we move the wheel, the values are changing (input), but it is not moving the motor. It is correctly mapped (pwm09 = p1_wheel ![]() how can i get it to work also, i would like to make code the made a pwm got to speen 255 when p4_sw_trig (trigger) is pushed(equal to 1). my code so far is if (p4_sw_trig == 1) { pwm12 = 255; (for this i commented out pwm12 = p4_wheel ![]() i also tried p4_wheel = 255; and i tried p4_wheel = 0xFC; } lastly, the y axis dose'nt work on ports 3 and 4 on any joystick i try please help me fix my code, wheels, and y-axes thanx |
|
#10
|
||||
|
||||
|
Re: Programming joysticks
I have two basic questions. First, can those old robot interfaces be programed for C or are they strictly the old stuff?
Second, does anyone have an old program with just the two joystick controls? All we want to do is hook up an old interface to a mock control board so we can make sure the trannys work. (Note: Im the fabricator, the only thing i know about computers is how to break one) Hopefully i can relay this answer to one of our more knowledgeable people. Thanks |
|
#11
|
||||
|
||||
|
Re: Programming joysticks
Quote:
|
|
#12
|
||||
|
||||
|
Re: Programming joysticks
Quote:
If you need any more assistance, feel free to ask. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Programming Compatition | Angela06 | Programming | 30 | 08-04-2005 23:12 |
| Could use some help with joysticks . . . | archiver | 2001 | 5 | 23-06-2002 23:36 |
| Pneumatics electrical wiring and programming | archiver | 2001 | 1 | 23-06-2002 23:10 |
| Calibrating speed controllers and joysticks | thedillybar | Technical Discussion | 4 | 11-02-2002 13:24 |
| pbasic programming | punarhero | Programming | 4 | 21-01-2002 23:32 |