Tripod program

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
vannerthehammer
Posts: 3
Joined: 10 Mar 2012, 17:31

Tripod program

Post 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.
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: Tripod program

Post 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
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
vannerthehammer
Posts: 3
Joined: 10 Mar 2012, 17:31

Re: Tripod program

Post by vannerthehammer »

Thank you man!!!! Thanks for the reply!!!!!!
vannerthehammer
Posts: 3
Joined: 10 Mar 2012, 17:31

Re: Tripod program

Post 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.
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: Tripod program

Post 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
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests