Page 1 of 1

Not valid for a prototype - newbie question

Posted: 13 Feb 2011, 19:24
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

Re: Not valid for a prototype - newbie question

Posted: 13 Feb 2011, 19:31
by spillerrec
You wrote a semicolon after "task sensor_ultra()", remove that semicolon and it will compile.

Re: Not valid for a prototype - newbie question

Posted: 13 Feb 2011, 19:37
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 :)