Go to Post Gracious professionalism dictates that if you come to play, I must help you. - Al Skierkiewicz [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
  #5   Spotlight this post!  
Unread 22-09-2005, 02:38
TimCraig TimCraig is offline
Registered User
AKA: Tim Craig
no team
 
Join Date: Aug 2004
Rookie Year: 2003
Location: San Jose, CA
Posts: 221
TimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to behold
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
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
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


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

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