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);
}
So my question: What is the problem here? Could someone explain what that error means?
Thanks
PS. Please forgive any language mistakesl Hopefully I put this topic in the right place