Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma config(Sensor, S4, Colour, sensorEV3_Color, modeEV3Color_Ambient)
- #pragma config(Motor, motorB, motorLeft, tmotorEV3_Large, PIDControl, encoder)
- #pragma config(Motor, motorC, motorRight, tmotorEV3_Large, PIDControl, encoder)
- //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
- /*
- Colour sensor modes
- 0 - modeEV3Color_Reflected
- 1 - modeEV3Color_Ambient
- 2 - modeEV3Color_Color
- 3 - modeEV3Color_Reflected_Raw
- 4 - modeEV3Color_RGB_Raw
- 5 - modeEV3Color_Calibration - Not utilized
- */
- task main()
- {
- while (true)
- {
- // Write the amount of reflected light to the screen
- // This is a value between 0 and 100, where 0 means no reflected
- // light and 100 means all light is being reflected
- displayBigTextLine(4, "Reflected: %d", SensorValue[Colour]);
- if(SensorValue[Colour] < 20)
- {
- motor[motorLeft] = 20;
- motor[motorRight] = 20;
- }
- else
- {
- motor[motorLeft] = -50;
- motor[motorRight] = 50;
- sleep(750);
- motor[motorLeft] = 100;
- motor[motorRight] = 100;
- sleep(1000);
- }
- // Wait 20 ms to get 50 readings per second
- sleep(20);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement