|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
C Programming Question
Ok, before I begin let me start off by saying that I have checked around to find the answer ot my question and I have not found a suitable answer, this may be due to the lack of my attention span though...lol. Ok my problem is I'm trying to use the trim wheel on the joystick to set the robot into autonomous mode. Now I first added the
Code:
unsigned char wheel_right |
|
#2
|
|||||
|
|||||
|
Re: C Programming Question
Quote:
Use one of the joystick buttons instead, say p1_sw_top, like: Code:
if (p1_sw_top) User_Autonomous_Code |
|
#3
|
||||
|
||||
|
Re: C Programming Question
Thanx
|
|
#4
|
||||
|
||||
|
Re: C Programming Question
just one more more question (maybe more depending on the answer...lol). im trying to write a practice autonomous code for the robot. my plan is to use the 'p1_sw_trig' button to enable a set of actions (in this case just to move the motor forward, then stop, then backward, then stop again using the counter function. im getting really weird syntax errors that i have no idea what's happening.
Code:
int counter = 0;
short end_program = 0;
void Process_Data_From_Local_IO(void)
{
if (end_program != 1)
{
counter++;
if ((p1_sw_trig == 1) && (counter <= 120))
{
pwm01 = 127;
}
else if ((p1_sw_trig == 1) && (counter > 120))
{
pwm01 = 255;
}
else if ((p1_sw_trig == 1) && (counter > 240))
{
pwm01 = 127;
}
else if ((p1_sw_trig == 1) && (counter > 360))
{
pwm01 = 0;
}
else if ((p1_sw_trig == 1) && (counter > 480))
{
pwm01 = 127;
end_program = 1;
}
}
/********************************************************/
/********************************************************/
/********************************************************/
<-------------------
|
|
#5
|
|||||
|
|||||
|
Re: C Programming Question
to your first post....if you need a variable in two classes than in the second you declare it:
code: extern vartype variable; in the second you forgot to close the IF statement with a } add id bfore the comments if you want to maintain pretty code the error is at that line bcause its either the end of the class or right before another method Last edited by blindguyinanorg : 15-02-2004 at 13:58. |
|
#6
|
||||
|
||||
|
Re: C Programming Question
yeah im using 2 different computers so i couldn't copy and paste it. i just typed it up at warp speed because i need to get this figured out before 4 today. there aren't any mistyped statements in the real code. and as for the answer you gave me for the first problem...thanks but i didn't need it anymore.
|
|
#7
|
||||
|
||||
|
does anyone else have any suggestions for a solution? like i said, i MUST get this down by 4 today. i've spent all yesterday (6+ hours) and now today (another 6+ hours) on this thing. our robot will be up and running very soon and i want to try to tweak the autonomous as much as possible and as of now, i can't even figure out how to create an autonomous mode.
![]() |
|
#8
|
||||
|
||||
|
Re: C Programming Question
man...nm...i forgot to post it but i got the solution. pay no head to this thread now.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| A few questions on programming the Control System | Avarik | Control System | 21 | 08-02-2004 11:42 |
| A question about control system options | computhief263 | Control System | 7 | 04-02-2004 14:46 |
| Q&A Discuss: Quick C Programming Q | CD47-Bot | Extra Discussion | 6 | 16-11-2003 11:16 |
| PBasic Question | Melissa H. | Programming | 28 | 17-11-2002 18:53 |
| Programming question | archiver | 2001 | 6 | 23-06-2002 22:57 |