Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int thresh= 100000;
- int distance = 0;
- sub checkdistance()
- {
- if(SensorUS(IN_1) < thresh)
- {
- thresh = SensorUS(IN_1);
- distance = MotorRotationCount(OUT_A);
- }
- }
- task main ()
- {
- SetSensorLowspeed(IN_1);
- SetSensorTouch(IN_3);
- repeat(144)
- {
- RotateMotorEx(OUT_A, 70, 10, 0, false, false);
- Wait(50);
- checkdistance();
- }
- RotateMotorEx(OUT_A, 40, distance, 0, false, true);
- Wait(100);
- while(SENSOR_3 == 0)
- {
- OnFwdSync(OUT_AC, 75, 0);
- }
- Off(OUT_AC);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement