#pragma config(Sensor, S1, touchSensor, sensorEV3_Touch) #pragma config(Sensor, S2, gyroSensor, sensorEV3_Gyro) #pragma config(Sensor, S3, colorSensor, sensorEV3_Color, modeEV3Color_Ambient) #pragma config(Sensor, S4, sonarSensor, sensorEV3_Ultrasonic) #pragma config(Motor, motorB, rightMotor, tmotorEV3_Large, PIDControl, driveRight, encoder) #pragma config(Motor, motorC, leftMotor, tmotorEV3_Large, PIDControl, driveLeft, encoder) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*// /* Create an autonomous program that uses the Color Sensor to switch the light on and off depending on the ambient light levels. */ task main() { //Loop forever. while(true) { //Wait for the level of ambient light intensity to drop below 15. while(getColorAmbient(colorSensor) >= 15) { //Do nothing while we're waiting. sleep(1); } //Display Image "Light on" on the LCD Screen. drawBmpfile(0, 127, "Light on"); //Wait for the level of ambient light intensity to rise above 15. while(getColorAmbient(colorSensor) <= 15) { //Do nothing while we're waiting. sleep(1); } //Erase the display to clear the LCD screen. eraseDisplay(); } }