Not valid for a prototype - newbie question

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
michal2195
Posts: 6
Joined: 11 Feb 2011, 11:35

Not valid for a prototype - newbie question

Post by michal2195 »

Hi Guys.
This is my first post so it would be polite to introduce mysefl. My name is Michal and I'm a student (at Poznan University of Economics - major connected with quant analysis and Computer Science). I just bought my Mindstorms set and after having some fun with the graphical software I decided to try BricxCC. This is my first program (I'm still getting to know how the sensors and other stuff works) so probably the question will be easy to answer. I tried to compile this code:

Code: Select all

#define do_przodu(predkosc, czas) \
OnFwd(OUT_AC, predkosc);Wait(czas);
#define do_tylu(predkosc, czas) \
OnRev(OUT_AC, predkosc);Wait(czas);
#define skret_prawo(predkosc, czas) \
OnFwd(OUT_C, predkosc); OnRev(OUT_A, predkosc); Wait(czas);
#define skret_lewo(predkosc, czas) \
OnFwd(OUT_A, predkosc); OnRev(OUT_C, predkosc); Wait(czas);

/* na dobrej nawierzchni przy predkosci 50, czasy dla skretow:
180 - 4 sek, 90 - 2 sek, 45 - 1 sek */

int skret_180 = 4000;
int skret_90 = 2000;
int skret_45 = 1000;

/* zmienna do sensora ultra, w cm */

int do_przeszkody = 10;


task jazda()
{
 while(true)
 {
 do_przodu(Random(50),3000);
 }
}

task sensor_ultra();
{
  while(true)
  {

              if (SensorUS(IN_4) > do_przeszkody)
              {
              stop jazda;
              Wait(1000);
              do_tylu(30, 1500);
              int losowy_skret = Random(1);
                  if (losowy_skret = 1)
                  {
                  skret_prawo(50, skret_90);
                  }
                  else
                  {
                  skret_lewo(50, skret_90);
                  }
              start jazda;
              }

  }
}
task main()
{
SetSensorLowspeed(IN_4);
Precedes(jazda, sensor_ultra);
}
The problem is I get the: "Not valid for a prototype" error. I tried to google it and use this forum, but was surprised that there are little to no solutions ;).
So my question: What is the problem here? Could someone explain what that error means?

Thanks :D
PS. Please forgive any language mistakesl Hopefully I put this topic in the right place
spillerrec
Posts: 358
Joined: 01 Oct 2010, 06:37
Location: Denmark
Contact:

Re: Not valid for a prototype - newbie question

Post by spillerrec »

You wrote a semicolon after "task sensor_ultra()", remove that semicolon and it will compile.
My blog: http://spillerrec.dk/category/lego/
RICcreator, an alternative to nxtRICeditV2: http://riccreator.sourceforge.net/
michal2195
Posts: 6
Joined: 11 Feb 2011, 11:35

Re: Not valid for a prototype - newbie question

Post by michal2195 »

Wow that was a quick answer. Thank you spillerrec. That was a stupid mistake :oops: but I'm kind of tired.
Thanks again :)
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests