0
나는 로봇이 소리를 따라 가도록하는 프로그램을 만들고 있지만 이상한 컴파일러 오류가 계속 발생합니다. 나는 컴파일러를 레일에서 벗어 던진 실수를 저질렀다고 생각한다.Bricx 커맨드 센터의 이상한 컴파일러 오류
#define TICKS_TO_SAMPLE 6
#define MS_TO_SAMPLE 100
#define TIME_TO_QUIET 250
#define ONE_THIRD 480
#define SAMPLE_DEPTH 20
#define NUM_OF_MOVEMENTS 6
#define TIME_MOVING 1000
#define MIC SENSOR_1
int gauge()
{
int soundMax = 0;
for(int tick = 0; tick < TICKS_TO_SAMPLE; tick++){
if(MIC > soundMax){
soundMax = MIC;
}
Wait(MS_TO_SAMPLE);
}
return soundMax;
}
int soundFind(int width)
{
int firstMax = 0;
firstMax = gauge();
OnFwd(OUT_A, 75);
Wait(width);
Off(OUT_AC);
Wait(TIME_TO_QUIET);
int secondMax = 0;
secondMax = gauge();
OnRev(OUT_A, 75);
Wait(width*2);
Off(OUT_AC, 75);
Wait(TIME_TO_QUIET);
int thirdMax = 0;
thirdMax = gauge();
if(firstMax >= secondMax && firstMax >= thirdMax)
{
OnRev(OUT_A, 75);
Wait(width);
Off(OUT_AC);
Wait(TIME_TO_QUIET);
}
else
{
if(secondMax >= firstMax && secondMax >= thirdMax)
{
OnRev(OUT_A, 75);
Wait(width*2);
Off(OUT_AC);
Wait(TIME_TO_QUIET);
}
}
if(width > SAMPLE_DEPTH)
{
return width/3;
}
else{
return 0;
}
}
task main()
{
int startingAngle = ONE_THIRD;
SetSensorSound(IN_1);
for(int movements = 0; movements < NUM_OF_MOVEMENTS; movements++){
startingAngle = soundFind(ONE_THIRD);
while(startingAngle > SAMPLE_DEPTH)
{
startingAngle = soundFind(ONE_THIRD);
}
OnRev(OUT_AC, 75);
Wait(TIME_MOVING);
Off(OUT_AC);
}
}
는 66-,
line 32 Error: ')' expected
line 32 Error: ';' expected
라인 32, 33, 35-39, 40, 45-48, 51, 58, 60-64에
Error: Unmatched close parenthesis
뱉어 68