Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <popx2.h>
- int L,R,x=0,y=0;
- void FF(){
- fd(60); sleep(300);
- }
- void R90(){
- fd(60);
- sound(1500,100);
- while(analog(2)>500) {sr(60);}
- while(analog(2)<500) {sr(60);}
- }
- void L90(){
- fd(60);
- sound(1500,100);
- while(analog(1)>500){sl(60);}
- while(analog(1)<500){sl(60);}
- }
- void hit(){
- bk(100); ao();
- servo(1,180); sleep(1000);
- servo(1,0);
- bk(60); sleep(200);
- R90();
- }
- void setup(){
- OK();
- setTextSize(2);
- glcdClear();
- glcd(1,1,"Let’s go!");
- }
- void loop(){
- L=analog(1);
- R=analog(2);
- if (L<500&&R<500){
- x++;
- switch (x){
- case 1 : L90();break;
- case 2 : hit();break;
- case 3 : FF();break;
- case 4 : hit();break;
- case 5 : x=0;
- y++;
- if (y==4){ ao(); servo (1,-1); while(1); }
- }
- }
- else if(L>500&&R>500){fd(60);}
- else if(L<500){sl(60);sleep(20);}
- else if(R<500){sr(60);sleep(20);}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement