//*!!Sensor, S1, lichtsensorA, sensorReflection, , !!*// //*!!Sensor, S2, lichtsensorB, sensorLightActive, , !!*// //*!!Sensor, S3, lichtsensorC, sensorReflection, , !!*// //*!! !!*// //*!!Start automatically generated configuration code. !!*// const tSensors lichtsensorA = (tSensors) S1; //sensorReflection //*!!!!*// const tSensors lichtsensorB = (tSensors) S2; //sensorLightActive //*!!!!*// const tSensors lichtsensorC = (tSensors) S3; //sensorReflection //*!!!!*// //*!!CLICK to edit 'wizard' created sensor & motor configuration. !!*// //*!!CLICK to edit 'wizard' created sensor & motor configuration. !!*// // Linefollowerprogram for a rover with 3 light sensors. Made by Laurens200 int sensorA = 0; int sensorB = 0; int sensorC = 0; task checksensor() // Checkt steeds de sensoren. { while(true) { if(SensorValue[S1] < 30) {sensorA = 1;} else{sensorA = 0;} if(SensorValue[S2] < 40) {sensorB = 1;} else{sensorB = 0;} if(SensorValue[S3] < 40) {sensorC = 1;} else{sensorC = 0;} } } task main() { StartTask(checksensor); // Start de checksensortaak. while(true) { motor[motorB] = 127; //motoren aan. motor[motorC] = 127; while(sensorB == 1) // wacht tot sensorB = wit {} while(sensorA == 0 && sensorC == 0) // wacht totdat sensor A of C zwart zijn. {} if(sensorA == 1) // als A zwart is... { motor[motorB] = 0; motor[motorC] = 127; } else // Als C zwart is { motor[motorB] = 127; motor[motorC] = 0; } while(sensorB == 0) // wacht tot B is zwart {} motor[motorB] = 0; motor[motorC] = 0; } }