|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#5
|
|||
|
|||
|
Re: Array problems( i think....)
You need to place code like the following somewhere that it gets called every time through the 26 millisecond control loop so your joystick values will be updated.
static unsigned char i = 0; if ((pw_sw_trig1 == 1) && (i < 90)) { left_side[i] = p1_y; right_side[i] = p2_y; i++; pwm01 = pwm02 = 127; } // end if Note that the counter is a static variable so it holds its value between passes through the loop. Also, you increment the counter before you use is so aside from your other problems, you'd never fill in the first item in each array. Remember C arrays start at 0. If pwm01 and pwm02 aren't being changed somewhere else in your code, you don't need to set them each pass through the loop. Or if you're, recording actual motor performance, then you don't need to keep setting them to 127. Hope this helps. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Array Problems: Possible<stdio.h> | Alex Wijtowych | Programming | 7 | 26-01-2005 04:39 |
| Robot Rodeo - fixing control problems | Gary Dillard | Off-Season Events | 7 | 26-10-2004 00:46 |
| Do you all have problems with.... | Munkaboo | Website Design/Showcase | 19 | 03-03-2003 19:51 |
| Joystick problems | archiver | 2001 | 3 | 24-06-2002 02:40 |