Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub vuelta(){
- Off(OUT_AB);
- OnFwd(OUT_A,50);
- OnRev(OUT_B,47) ;
- Wait(400);
- }
- sub avanzar(){
- OnFwd(OUT_A,60);
- OnFwd(OUT_B,57);
- }
- task main(){
- SetSensorLight (IN_2);
- SetSensorLowspeed (IN_4);
- while (TRUE)
- {
- NumOut(5,5,SensorUS(IN_4));
- if (SensorUS(IN_4)<=15) {
- Off(OUT_AB);
- Wait(1000);
- OnRev(OUT_AB,50);
- Wait(400);
- vuelta();
- Wait(1000);
- }
- else
- {
- if(SENSOR_2<=60)
- {
- Off(OUT_AB);
- OnFwd(OUT_A,40);
- OnFwd(OUT_B,0);
- }
- else
- {
- Off(OUT_AB);
- OnFwd(OUT_B,40);
- OnFwd(OUT_A,0);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement