
Could anybody give help with my project ^^
Hello, everyone. I currently get a project. The robot need to detect little green circles on a white cradborad. Where out side the white cardborad is black carpet. The robot is not permitted to leave the field. The map however is uploaded as attachment. Below is code I have written, could anybody check if please.
#pragma config(Sensor, S1, senSound, sensorSoundDB)
#pragma config(Sensor, S2, senLIGHT2, sensorLightActive)
#pragma config(Sensor, S3, senLIGHT1, sensorLightActive)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main()
{
while(true)
{
if (SensorValue(senLIGHT1)>57) // white carborad is lighter than 57, so when continue to run around and around on the map//
{
motor[motorB] = 100;
motor[motorC] = 80;
}
else if(SensorValue(senLIGHT1)<34.5) // the robot meet black carpet, so turn right, then continue to run around on the map//
{ motor[motorB] = 50;
motor[motorC] = -50;
wait1Msec(1000);
}
else //the robot meet green circles, display " yeah" on the screen of brick//
{
nxtDisplayScringAt(0,31, "yeah");
wait1Msec(1000);
motor[motorB] = -50;
motor[motorC] = 50;
}
}
}
I know there are many errors in this code. Could anybody point out or fix, thank you very much!
