SHARE
TWEET

Untitled

a guest Mar 21st, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "Main.h"
  2.  
  3. int KnockedBinders = 0;
  4. int BinderThreshold = 42;
  5.  
  6. unsigned char UltrasonicA = 1, UltrasonicB = 9, BumperSwitch = 2;
  7.  
  8. void CMain ( void )
  9. {
  10.     StartUltrasonic ( UltrasonicA , UltrasonicB ) ;
  11.    
  12.     //while(1) {
  13.     //    PrintToScreen("ULTRA: %d\n", GetUltrasonicCm ( UltrasonicA , UltrasonicB ));
  14.     //}
  15.    
  16.     while(KnockedBinders < 4) {
  17.         SetMotor ( 1 , -35 ) ;
  18.         SetMotor ( 10 , -35 ) ;
  19.         if(GetUltrasonicCm ( UltrasonicA , UltrasonicB ) < BinderThreshold) {
  20.             Wait(500);
  21.             SetMotor ( 1 , 35 ) ;
  22.             SetMotor ( 10 , -35 ) ;
  23.             while(GetDigitalInput ( BumperSwitch )) { }
  24.             Wait(100);
  25.             SetMotor ( 1 , -35 ) ;
  26.             SetMotor ( 10 , 35 ) ;
  27.             Wait(1000);
  28.             KnockedBinders++;
  29.         }
  30.     }
  31.     SetMotor(1, 0);
  32.     SetMotor(10, 0);
  33. }
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. OK, I Understand
 
Top