|
I know most of the if statements are diamonds shapes and count is a process, i am correct? And the while statement goes back, after the count?
Here is my code, need some help translating it to a flowchart.
#define LightThreshold 20 #define Fast 60 #define Slow 40
task main() { SetSensorType(S1, SENSOR_TYPE_LIGHT); SetSensorMode(S1, SENSOR_MODE_PERCENT);
SetSensorType(S2, SENSOR_TYPE_LIGHT); SetSensorMode(S2, SENSOR_MODE_PERCENT);
int count=0;
while(count < 2) { if (SENSOR_1>LightThreshold&&SENSOR_2>LightThreshold) { OnFwd(OUT_AC, Slow); } if (SENSOR_1>=LightThreshold&&SENSOR_2<LightThreshold) { Off(OUT_C); OnFwd(OUT_A, Fast); } if (SENSOR_1<LightThreshold&&SENSOR_2>=LightThreshold) { Off(OUT_A); OnFwd(OUT_C, Fast); } if (SENSOR_1<LightThreshold&&SENSOR_2<LightThreshold) { if (count == 0) { TextOut (0, LCD_LINE3, "Good Job!, Bot reaches point B" ); OnFwd (OUT_C, Fast); OnRev (OUT_A, Fast); Wait (500); } count=count+1; } } Off(OUT_AC); PlayFile("CASHREG.rso"); Wait(2000); }
|