Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma config(Motor, motorB, rightMotor, tmotorNormal, PIDControl, encoder)
- #pragma config(Motor, motorC, leftMotor, tmotorNormal, PIDControl, encoder)
- task main()
- {
- char mapa[6][6] = {
- {'D','R','R','R','R','D'},
- {'D','U',' ',' ',' ','D'},
- {'R','U',' ',' ',' ','D'},
- {' ',' ',' ',' ',' ','D'},
- {' ',' ',' ',' ',' ','D'},
- {' ',' ',' ','X','L','L'}
- };
- int x=0;
- int y=0;
- while(true){
- if(mapa[x][y]=='D'){
- motor[motorB]=0;
- motor[motorC]=0;
- wait1Msec(2000);
- motor[motorB]=50;
- motor[motorC]=50;
- wait1Msec(2000);
- x++;
- }
- else if(mapa[x][y]=='R'){
- motor[motorB]=0;
- motor[motorC]=0;
- wait1Msec(2000);
- motor[motorB]=-30;
- motor[motorC]=30;
- wait1Msec(1550);
- y++;}
- else if(mapa[x][y]=='U'){
- motor[motorB]=0;
- motor[motorC]=0;
- wait1Msec(2000);
- motor[motorB]=50;
- motor[motorC]=50;
- wait1Msec(2000);
- x--;}
- else if(mapa[x][y]=='L'){
- motor[motorB]=0;
- motor[motorC]=0;
- wait1Msec(2000);
- motor[motorB]=30;
- motor[motorC]=0;
- wait1Msec(1550);
- y--;}
- else if(mapa[x][y]=='X'){
- break;}
- }
- }
Add Comment
Please, Sign In to add comment