|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: What is wrong with this code???? It won't Compile and I don't know why? Please He
Here's what I found in the users guide:
Quote:
I pasted your code into an editor and it looks like line 367 is "if (drive_timer > LOST_TARGET_TIMEOUT)", is that correct? If so, can you show us the section from the header file that defines "LOST_TARGET_TIMEOUT"? |
|
#2
|
||||
|
||||
|
That was all there was in the compile box and I posted the whole .c file; is there a different file that you want to see???
![]() |
|
#3
|
|||||
|
|||||
|
Re: What is wrong with this code???? It won't Compile and I don't know why? Please Help
Quote:
2- Is this a file you wrote/modified? 3- Is there a Navigate.h? that might be what he is talking about. 4- Did you write this code? |
|
#4
|
|||||
|
|||||
|
Re: What is wrong with this code???? It won't Compile and I don't know why? Please Help
Hi,
He'd like you to post your Navigate.h header file, to look at how LOST_TARGET_TIMEOUT is defined...if that is where it is defined. You could also do a search, through the folder that you have your code in, to see if it turns up anywhere. If not, then the you've found your error Eric Schreffler |
|
#5
|
|||||
|
|||||
|
Re: What is wrong with this code???? It won't Compile and I don't know why? Please Help
Or, in MPLAB, Project>Find in Project files... and type in "LOST_TARGET_TIMEOUT" (w/o quotes). in the Output window, see where it comes up.
|
|
#6
|
|||||
|
|||||
|
Re: What is wrong with this code???? It won't Compile and I don't know why? Please Help
Dave's right, the compiler is complaining about line 367:
Code:
if (drive_timer > LOST_TARGET_TIMEOUT) If that doesn't help, then show us the section of the header file where LOST_TARGET_TIMEOUT is defined (probably in navigate.h). (Oh, and next time you need to post programs here, surround it with [CODE] and [/CODE] so the formatting is preserved.) |
|
#7
|
|||
|
|||
|
Re: What is wrong with this code???? It won't Compile and I don't know why? Please He
Quote:
|
|
#8
|
|||||
|
|||||
|
Re: What is wrong with this code???? It won't Compile and I don't know why? Please He
Quote:
Code:
case DR_BOTH_CENTER:
{
Navigator_State = AT_TARGET; // Both servos are within the target threshold
printf("AT_TARGET\n");
break;
}
}
}
else
{
// We are not locked on - Stop
// give the trackers a chance to catch up
left_drive_set = LSTOP;
right_drive_set = RSTOP;
drive_timer++ ;
if (drive_timer > LOST_TARGET_TIMEOUT)
{
Navigator_State = TURN_TO_TARGET;
printf("TURN_TO_TARGET\n"); // Done driving to center
left_servo_set = 127;
right_servo_set = 127;
}
}
break;
}
There is also a case statement commented out near the top of the big switch. That can't be doing what you want, can it? If you want to "skip" that state, as the comments suggest, I think you need to initialize your state variable to DRIVE_TO_CENTER instead of WAIT_TO_DRIVE in line 37. |
|
#9
|
||||
|
||||
|
Re: What is wrong with this code???? It won't Compile and I don't know why? Please He
Quote:
357 matches to 353 (case DR_BOTH_CENTER) 358 matches to 258(switch drive_state) 359 matches to 207(if Tracker_Data...) I think that you're onto something with that commented case at line 131. That's definately not right Last edited by Dave Scheck : 24-03-2004 at 12:40. |
|
#10
|
|||||
|
|||||
|
Re: What is wrong with this code???? It won't Compile and I don't know why? Please He
Quote:
As to the commented out case label, THAT does look strange, but I highly doubt that would cause the compile error in question. I don't know what the compiler will do with a chunk of code inside a switch statement without a case label. My guess is that it will simply be unreachable. |
|
#11
|
||||||
|
||||||
|
Re: What is wrong with this code???? It won't Compile and I don't know why? Please He
Quote:
|
|
#12
|
||||
|
||||
|
Re: What is wrong with this code???? It won't Compile and I don't know why? Please He
indent...indent...indent
|
|
#13
|
|||||
|
|||||
|
Re: What is wrong with this code???? It won't Compile and I don't know why? Please He
Quote:
If the trouble is with an unprintable character in the source code, the problem character probably wouldn't have survived being pasted here. But I believe that the definition of LOST_TARGET_TIMEOUT in navigate.h is a likely culprit and should be investigated. |
|
#14
|
|||||
|
|||||
|
Re: What is wrong with this code???? It won't Compile and I don't know why? Please He
Quote:
Last edited by Greg Ross : 24-03-2004 at 15:55. |
|
#15
|
|||||
|
|||||
|
Re: What is wrong with this code???? It won't Compile and I don't know why? Please He
Quote:
I'm not anywhere near the computer we use to program the robot -- in fact, it's halfway to Chicago at the moment. I interpreted your mention of "the editor" as referring to viewing the HTML source of the page, where at least a little of the c file's formatting seems to be visible. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What is your most prefered programming language? | Hailfire | Programming | 156 | 19-01-2005 21:42 |
| Printf warning during compile? | actorindp | Programming | 4 | 20-02-2004 17:02 |
| How to measure execution time? And code size? | gnormhurst | Programming | 17 | 17-02-2004 08:06 |
| Can't Compile the Default Code | pressurex1 | Programming | 4 | 25-01-2004 20:26 |
| Problem with FRC Default code | AsimC | Programming | 2 | 11-01-2004 19:22 |