<p>I got this to work. Set the optimisation level to 1 on the NBC/NXC tab of the compilation options. Then recompile and download.</p>

<p><a href="https://i.sstatic.net/PLhFC.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/PLhFC.png" alt="enter image description here"></a></p>

CC BY-SA 3.0
2017-01-25T18:26:10.080Z
2017-01-25T18:26:10.080Z
A_M
<p>I had the exact same problem when I built the tripod. This program is written in BrickCC, instead of the standard NXT-G. The way to solve this is to download and install the compiler for brickCC, which can be found by browsing the tripod section on robotsquare <a href="http://robotsquare.com/2012/03/03/tutorial-official-bonus-models/" rel="nofollow" title="here">here. </a></p>

<p>Sources: robotsquare.com</p>

CC BY-SA 3.0
2015-11-09T11:43:32.910Z
Umm, I used BricxCC 3.3.8.9 to compile and transfer the program.
Timtech
CC BY-SA 3.0
2015-11-10T08:23:10.817Z
Oh. Ok. Um. I haven't got anything else.
noided
CC BY-SA 3.0
2015-11-09T08:10:47.293Z
2015-11-09T08:10:47.293Z
noided
<p>I am getting a file error when I try to run this on my NXT 2.0. It's my first time using NXC and the program compiles and transfers fine...</p>

<p>I tried replacing the batteries, the only other thing is that I thought maybe there was a firmware problem. Only thing is, I'd rather not get a custom firmware if I don't have to.</p>

<pre><code>/**
 * Tripod walker
 *
 * Description:  This the Tripod program, to make it walk, turn, and avoid obstacles
 *
 * Notes: Compile for 2.0 NXT firmware (1.028)
 *
 * @author Daniele Benedettelli, MCP http://robotics.benedettelli.com, Copyright (C) 2012.
 *
 * @see The GNU Public License (GPL)
 */

/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
 * for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

#define STEP_PAUSE 80

#define LEFT_LEG OUT_C
#define REAR_LEG OUT_B
#define RIGHT_LEG OUT_A
#define EYE IN_4

#define NEAR 25
#define NONE -1
#define LEFT 1
#define RIGHT 2
#define FRONT 3
#define BACK 4

#define CW 1
#define CCW 0

#define KP 30
#define KD 10
#define KI 0
#define DAMP 60
#define SCALE 5

#define MID 60

int ref[3];


void Set(byte rear, byte left, byte right)
{
   ref[REAR_LEG] = rear;
   ref[LEFT_LEG] = left;
   ref[RIGHT_LEG] = right;
}

void Pulse(byte motor, int times, bool long_pulse)
{
   repeat (times)
   {
      ref[motor] = MID+10;
      Wait(80);
      //Wait(70+long_pulse*30);
      ref[motor] = MID-10;
      Wait(80);
   }
}

void PulseDouble(byte motor_one, byte motor_two, int times, bool long_pulse)
{
   repeat (times)
   {
      ref[motor_one] = 80;
      ref[motor_two] = 80;
      Wait(50+long_pulse*40);
      ref[motor_one] = 40;
      ref[motor_two] = 40;
   }
}

void Walk (int dir, int times)
{
   repeat(times)
   {
      if (dir == FRONT)
      {
         Set(MID-20,MID,MID);
         Wait(300);
         Set(MID+10,MID,MID);
         Wait(200);
      }
      else if (dir == BACK)
      {
         Set(MID-10,MID+20,MID+20);
         Wait(150);
         Set(MID-10,MID-10,MID-10);
         Wait(300);
      }
      else if (dir == RIGHT)
      {
         Set(MID-10,MID-20,MID-10);
         Wait(80);
         Set(MID+10,MID-20,MID+10);
         Wait(150);
         Set(MID-10,MID-20,MID-10);
         Wait(300);
      }
      else if (dir == LEFT)
      {
         Set(MID-10,MID-10,MID-20);
         Wait(80);
         Set(MID+10,MID+10,MID-20);
         Wait(150);
         Set(MID-10,MID-10,MID-20);
         Wait(300);
      }
//      if (times&gt;1)  Wait(STEP_PAUSE);
   }
}

void Turn(int wise, int times)
{
   repeat (times)
   {
      ref[REAR_LEG] = MID-10;
      ref[wise==CCW? RIGHT_LEG:LEFT_LEG] = MID+10;
      Wait(100);
      ref[wise==CCW? LEFT_LEG:RIGHT_LEG] = MID+10;
      ref[wise==CCW? RIGHT_LEG:LEFT_LEG] = MID-10;
      Wait(100);
      ref[wise==CCW? LEFT_LEG:RIGHT_LEG] = MID-10;
      ref[REAR_LEG] = MID+10;
      Wait(100);
//      Pulse( wise==CCW? REAR_LEG:LEFT_LEG, 1, false);
//      Pulse(RIGHT_LEG,1,false);
//      Pulse( wise==CCW? LEFT_LEG:REAR_LEG,1,false);
   }
}

void Demo()
{
   Walk(FRONT,10);
   Turn(CCW,10);
   Walk(FRONT,10);
   Turn(CW,10);
   Walk(FRONT,10);
   Walk(LEFT,10);
   Walk(RIGHT,10);
}


task motorAcontroller()
{
   int err, P, I, D, PID, Apos, Aold;
   ResetAllTachoCounts(OUT_A);
   ResetRotationCount(OUT_A);
   while(true)
   {
      Apos = MotorRotationCount(OUT_A);
      err = Apos - ref[OUT_A];
      P = KP*err;
      I = err + KI*I*(100-DAMP)/100;
      D = KD*(err-Aold);
      PID = (P + I + D)/SCALE;
      PID = abs(PID)&gt;100? sign(PID)*100 : PID;
      OnRev(OUT_A,PID);
      Aold = err;
   }
}

task motorBcontroller()
{
   int err, P, I, D, PID, Bpos, Bold;
   ResetAllTachoCounts(OUT_B);
   ResetRotationCount(OUT_B);
   while(true)
   {
      Bpos = MotorRotationCount(OUT_B);
      err = Bpos - ref[OUT_B];
      P = KP*err;
      I = err + KI*I*(100-DAMP)/100;
      D = KD*(err-Bold);
      PID = (P + I + D)/SCALE;
      PID = abs(PID)&gt;100? sign(PID)*100 : PID;
      OnRev(OUT_B,PID);
      Bold = err;
   }
}

task motorCcontroller()
{
   int err, P, I, D, PID, Cpos, Cold;
   ResetAllTachoCounts(OUT_C);
   ResetRotationCount(OUT_C);
   while(true)
   {
      Cpos = MotorRotationCount(OUT_C);
      err = Cpos - ref[OUT_C];
      P = KP*err;
      I = err + KI*I*(100-DAMP)/100;
      D = KD*(err-Cold);
      PID = (P + I + D)/SCALE;
      PID = abs(PID)&gt;100? sign(PID)*100 : PID;
      OnRev(OUT_C,PID);
      Cold = err;
   }
}

void triped_init()
{
   //SetSensorLowspeed(LEFT_EYE);
   //SetSensorLowspeed(RIGHT_EYE);
   SetSensorLowspeed(EYE);
   OnRev(OUT_ABC,20);
   Wait(80);
   Float(OUT_ABC);
   Wait(500);
   start motorAcontroller;
   start motorBcontroller;
   start motorCcontroller;
   //Set(MID+40,MID+40,MID+40);
   //Wait(1000);
   Set(MID,MID,MID);
   Wait(1000);
   /*
   repeat(3)
   {
      Set(MID,MID+20,MID+20);
      Wait(200);
      Set(MID+20,MID+20,MID);
      Wait(200);
      Set(MID+20,MID,MID+20);
      Wait(600);
   }
   Set(MID,MID,MID);
   */
}

void Jump( int times )
{
   repeat (times)
   {
      Set(90,90,90);
      Wait(1000);
      for (int i=90; i &gt;=30; i--)
      {
         Set(i,i,i);
         Wait(1);
      }
      Wait(1000);
   }
}

task main()
{
   int count;
   triped_init();
   while (true)
   {
      if (ButtonPressed(BTNCENTER,true))
      {
         Set(MID+50,MID+50,MID+50);
         while(ButtonPressed(BTNCENTER,true));
         until(ButtonPressed(BTNCENTER,true));
      }
      if (SensorUS(EYE)&gt;NEAR)
      {
         Walk(FRONT,1);
      }
      else
      {
         Walk(BACK,3);
         count = 0;
         while(SensorUS(EYE)&lt;=NEAR &amp;&amp; count&lt;20)
         {
            Turn(CCW,3);
            count++;
         }
         if (SensorUS(EYE)&lt;=NEAR)
         {
            count = 0;
            while(SensorUS(EYE)&lt;NEAR &amp;&amp; count&lt;20)
            {
               Turn(CW,3);
               count++;
            }
            Walk(LEFT,4);
         }
         else
         {
            Walk(RIGHT,4);
         }
         //Turn(CCW,5);
      }
   }
}
</code></pre>

<h2>the error</h2>

<p><img src="https://i.sstatic.net/G9lsw.jpg" alt="the error"></p>

CC BY-SA 3.0
2015-11-09T00:25:32.160Z
@jdv "File error" on the NXT, literally... here, take a look - http://imgur.com/kzjuc0N
Timtech
CC BY-SA 3.0
2015-11-09T11:44:01.370Z
@jdv It could be a memory error, because I've got a bunch of other stuff on there. I'll check a simple program later.
Timtech
CC BY-SA 3.0
2015-11-09T11:47:23.700Z
Scratch the possible memory problem. I deleted huge amount of stuff, and the error is still exactly the same.
Timtech
<nxc>
Help with this .nxc Tripod program
Timtech
# Help with this .nxc Tripod program

(Asked by: username_0 on 2015-11-08)

I am getting a file error when I try to run this on my NXT 2.0. It's my first time using NXC and the program compiles and transfers fine...
I tried replacing the batteries, the only other thing is that I thought maybe there was a firmware problem. Only thing is, I'd rather not get a custom firmware if I don't have to.
/**
 * Tripod walker
 *
 * Description:  This the Tripod program, to make it walk, turn, and avoid obstacles
 *
 * Notes: Compile for 2.0 NXT firmware (1.028)
 *
 * @author Daniele Benedettelli, MCP http://robotics.benedettelli.com, Copyright (C) 2012.
 *
 * @see The GNU Public License (GPL)
 */

/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
 * for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

#define STEP_PAUSE 80

#define LEFT_LEG OUT_C
#define REAR_LEG OUT_B
#define RIGHT_LEG OUT_A
#define EYE IN_4

#define NEAR 25
#define NONE -1
#define LEFT 1
#define RIGHT 2
#define FRONT 3
#define BACK 4

#define CW 1
#define CCW 0

#define KP 30
#define KD 10
#define KI 0
#define DAMP 60
#define SCALE 5

#define MID 60

int ref[3];


void Set(byte rear, byte left, byte right)
{
   ref[REAR_LEG] = rear;
   ref[LEFT_LEG] = left;
   ref[RIGHT_LEG] = right;
}

void Pulse(byte motor, int times, bool long_pulse)
{
   repeat (times)
   {
      ref[motor] = MID+10;
      Wait(80);
      //Wait(70+long_pulse*30);
      ref[motor] = MID-10;
      Wait(80);
   }
}

void PulseDouble(byte motor_one, byte motor_two, int times, bool long_pulse)
{
   repeat (times)
   {
      ref[motor_one] = 80;
      ref[motor_two] = 80;
      Wait(50+long_pulse*40);
      ref[motor_one] = 40;
      ref[motor_two] = 40;
   }
}

void Walk (int dir, int times)
{
   repeat(times)
   {
      if (dir == FRONT)
      {
         Set(MID-20,MID,MID);
         Wait(300);
         Set(MID+10,MID,MID);
         Wait(200);
      }
      else if (dir == BACK)
      {
         Set(MID-10,MID+20,MID+20);
         Wait(150);
         Set(MID-10,MID-10,MID-10);
         Wait(300);
      }
      else if (dir == RIGHT)
      {
         Set(MID-10,MID-20,MID-10);
         Wait(80);
         Set(MID+10,MID-20,MID+10);
         Wait(150);
         Set(MID-10,MID-20,MID-10);
         Wait(300);
      }
      else if (dir == LEFT)
      {
         Set(MID-10,MID-10,MID-20);
         Wait(80);
         Set(MID+10,MID+10,MID-20);
         Wait(150);
         Set(MID-10,MID-10,MID-20);
         Wait(300);
      }
//      if (times>1)  Wait(STEP_PAUSE);
   }
}

void Turn(int wise, int times)
{
   repeat (times)
   {
      ref[REAR_LEG] = MID-10;
      ref[wise==CCW? RIGHT_LEG:LEFT_LEG] = MID+10;
      Wait(100);
      ref[wise==CCW? LEFT_LEG:RIGHT_LEG] = MID+10;
      ref[wise==CCW? RIGHT_LEG:LEFT_LEG] = MID-10;
      Wait(100);
      ref[wise==CCW? LEFT_LEG:RIGHT_LEG] = MID-10;
      ref[REAR_LEG] = MID+10;
      Wait(100);
//      Pulse( wise==CCW? REAR_LEG:LEFT_LEG, 1, false);
//      Pulse(RIGHT_LEG,1,false);
//      Pulse( wise==CCW? LEFT_LEG:REAR_LEG,1,false);
   }
}

void Demo()
{
   Walk(FRONT,10);
   Turn(CCW,10);
   Walk(FRONT,10);
   Turn(CW,10);
   Walk(FRONT,10);
   Walk(LEFT,10);
   Walk(RIGHT,10);
}


task motorAcontroller()
{
   int err, P, I, D, PID, Apos, Aold;
   ResetAllTachoCounts(OUT_A);
   ResetRotationCount(OUT_A);
   while(true)
   {
      Apos = MotorRotationCount(OUT_A);
      err = Apos - ref[OUT_A];
      P = KP*err;
      I = err + KI*I*(100-DAMP)/100;
      D = KD*(err-Aold);
      PID = (P + I + D)/SCALE;
      PID = abs(PID)>100? sign(PID)*100 : PID;
      OnRev(OUT_A,PID);
      Aold = err;
   }
}

task motorBcontroller()
{
   int err, P, I, D, PID, Bpos, Bold;
   ResetAllTachoCounts(OUT_B);
   ResetRotationCount(OUT_B);
   while(true)
   {
      Bpos = MotorRotationCount(OUT_B);
      err = Bpos - ref[OUT_B];
      P = KP*err;
      I = err + KI*I*(100-DAMP)/100;
      D = KD*(err-Bold);
      PID = (P + I + D)/SCALE;
      PID = abs(PID)>100? sign(PID)*100 : PID;
      OnRev(OUT_B,PID);
      Bold = err;
   }
}

task motorCcontroller()
{
   int err, P, I, D, PID, Cpos, Cold;
   ResetAllTachoCounts(OUT_C);
   ResetRotationCount(OUT_C);
   while(true)
   {
      Cpos = MotorRotationCount(OUT_C);
      err = Cpos - ref[OUT_C];
      P = KP*err;
      I = err + KI*I*(100-DAMP)/100;
      D = KD*(err-Cold);
      PID = (P + I + D)/SCALE;
      PID = abs(PID)>100? sign(PID)*100 : PID;
      OnRev(OUT_C,PID);
      Cold = err;
   }
}

void triped_init()
{
   //SetSensorLowspeed(LEFT_EYE);
   //SetSensorLowspeed(RIGHT_EYE);
   SetSensorLowspeed(EYE);
   OnRev(OUT_ABC,20);
   Wait(80);
   Float(OUT_ABC);
   Wait(500);
   start motorAcontroller;
   start motorBcontroller;
   start motorCcontroller;
   //Set(MID+40,MID+40,MID+40);
   //Wait(1000);
   Set(MID,MID,MID);
   Wait(1000);
   /*
   repeat(3)
   {
      Set(MID,MID+20,MID+20);
      Wait(200);
      Set(MID+20,MID+20,MID);
      Wait(200);
      Set(MID+20,MID,MID+20);
      Wait(600);
   }
   Set(MID,MID,MID);
   */
}

void Jump( int times )
{
   repeat (times)
   {
      Set(90,90,90);
      Wait(1000);
      for (int i=90; i >=30; i--)
      {
         Set(i,i,i);
         Wait(1);
      }
      Wait(1000);
   }
}

task main()
{
   int count;
   triped_init();
   while (true)
   {
      if (ButtonPressed(BTNCENTER,true))
      {
         Set(MID+50,MID+50,MID+50);
         while(ButtonPressed(BTNCENTER,true));
         until(ButtonPressed(BTNCENTER,true));
      }
      if (SensorUS(EYE)>NEAR)
      {
         Walk(FRONT,1);
      }
      else
      {
         Walk(BACK,3);
         count = 0;
         while(SensorUS(EYE)<=NEAR && count<20)
         {
            Turn(CCW,3);
            count++;
         }
         if (SensorUS(EYE)<=NEAR)
         {
            count = 0;
            while(SensorUS(EYE)
the error

**Tags:** nxc

> **Comments:**
> **username_0**: @jdv "File error" on the NXT, literally... here, take a look - http://imgur.com/kzjuc0N  
> **username_0**: @jdv It could be a memory error, because I've got a bunch of other stuff on there. I'll check a simple program later.  
> **username_0**: Scratch the possible memory problem. I deleted huge amount of stuff, and the error is still exactly the same.  

---

## 2 answers

### Answer by username_1 on 2017-01-25. Score: 2

I got this to work. Set the optimisation level to 1 on the NBC/NXC tab of the compilation options. Then recompile and download.

[![enter image description here](https://i.sstatic.net/PLhFC.png)](https://i.sstatic.net/PLhFC.png)


---

### Answer by username_2 on 2015-11-09. Score: 1

I had the exact same problem when I built the tripod. This program is written in BrickCC, instead of the standard NXT-G. The way to solve this is to download and install the compiler for brickCC, which can be found by browsing the tripod section on robotsquare [here.](http://robotsquare.com/2012/03/03/tutorial-official-bonus-models/ "here")

Sources: robotsquare.com

> **Comments:**
> **username_0**: Umm, I used BricxCC 3.3.8.9 to compile and transfer the program.  
> **username_2**: Oh. Ok. Um. I haven't got anything else.  

---

