Page 1 of 1

Tripod program

Posted: 10 Mar 2012, 17:33
by vannerthehammer
Hi, I`m trying to make the tripod from daniele Benedettelli. The program is from his web.



But when I compile the program, it says that have an error in line 161 and 162
Line 161: Error: Error parsing expression: LEFT_EYE
Line 162: Error: Error parsing expression: RIGHT_EYE.

Im a robot builder but i don´t have the skills on NXC. Can u help me please? Maybe it's an error of mine, I don't Know.
Thanks for your time and for your creations.
Keep on rockin'!!!!

Thanks again.

Re: Tripod program

Posted: 10 Mar 2012, 18:41
by afanofosc
It looks like Danny uploaded a broken version of his code. The function sonar is not used anywhere else in the program so you can safely comment the whole thing out. Like this:

Code: Select all

/*
int sonar()
{
   int dir = NONE; //no obstacle
   int left = SensorUS(LEFT_EYE);
   int right = SensorUS(RIGHT_EYE);
   if (left>=NEAR && right>=NEAR) dir = NONE;
   else
   {
      if (left<NEAR && right>=NEAR) dir = LEFT;
      if (left<NEAR && right<NEAR) dir = FRONT;
      if (left>=NEAR && right<NEAR) dir = RIGHT;
   }
   return dir;
}
*/
Alternatively, you could add a couple lines at the top of the source code like this:

Code: Select all

#define LEFT_EYE IN_4
#define RIGHT_EYE IN_4
John Hansen

Re: Tripod program

Posted: 10 Mar 2012, 19:01
by vannerthehammer
Thank you man!!!! Thanks for the reply!!!!!!

Re: Tripod program

Posted: 11 Mar 2012, 15:34
by vannerthehammer
I make those changes in the program, but doesn´t run.
Now compile but when I press the start button, automatically nxt stops, and the screen says: file error.
But thanks for the support.

Re: Tripod program

Posted: 11 Mar 2012, 18:10
by afanofosc
Danny is having trouble posting on these forums, which I hope we can get fixed, but in the meantime he asked me to mention here that he has uploaded a new tripod zip with the correct program source code.

http://robotics.benedettelli.com/tripod.htm

One thing to keep in mind when using NXC with the NXT is that NXC can be compiled to run on an NXT that has the standard firmware installed on it but it can also be compiled to run on an NXT that has the enhanced NBC/NXC firmware on it. If you get a File Error message and there is no number shown on the screen then that indicates you have the standard NXT firmware on your NXT. In that case then it is very important to make sure that the code is compiled with the standard firmware as the target rather than the enhanced firmware. You will definitely get a File Error message if you try to run a program that targets the enhanced firmware on a brick that is running the standard firmware.

Can you elaborate on what version of the NBC compiler you are using as well as what OS platform you run it under (windows, mac OS X, or linux). Also, if you are using Windows, whether you are using the BricxCC IDE or not?

John Hansen