• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Feb 11th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. #pragma config(Motor,  motorB,          rightMotor,         tmotorNormal, PIDControl, encoder)
2. #pragma config(Motor,  motorC,          leftMotor,          tmotorNormal, PIDControl, encoder)
3.
4.
6. {
7.    char mapa[6][6] = {
8.   {'D','R','R','R','R','D'},
9.   {'D','U',' ',' ',' ','D'},
10.   {'R','U',' ',' ',' ','D'},
11.   {' ',' ',' ',' ',' ','D'},
12.   {' ',' ',' ',' ',' ','D'},
13.   {' ',' ',' ','X','L','L'}
14.   };
15.   int x=0;
16.   int y=0;
17.   while(true){
18.     if(mapa[x][y]=='D'){
19.       motor[motorB]=0;
20.       motor[motorC]=0;
21.       wait1Msec(2000);
22.       motor[motorB]=50;
23.       motor[motorC]=50;
24.       wait1Msec(2000);
25.       x++;
26.     }
27.     else if(mapa[x][y]=='R'){
28.       motor[motorB]=0;
29.       motor[motorC]=0;
30.       wait1Msec(2000);
31.       motor[motorB]=-30;
32.       motor[motorC]=30;
33.       wait1Msec(1550);
34.       y++;}
35.      else if(mapa[x][y]=='U'){
36.       motor[motorB]=0;
37.       motor[motorC]=0;
38.       wait1Msec(2000);
39.       motor[motorB]=50;
40.       motor[motorC]=50;
41.       wait1Msec(2000);
42.       x--;}
43.       else if(mapa[x][y]=='L'){
44.       motor[motorB]=0;
45.       motor[motorC]=0;
46.       wait1Msec(2000);
47.       motor[motorB]=30;
48.       motor[motorC]=0;
49.       wait1Msec(1550);
50.       y--;}
51.       else if(mapa[x][y]=='X'){
52.       break;}
53.
54.   }
55. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top