SHARE
TWEET

Untitled

a guest Dec 9th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define odlegloscOdPrzeszkody 25
  2. #define kraniecRingu 6
  3. #define iloscObrotowDoPelnegoObrotu 27
  4.  
  5. task main()
  6. {
  7.  SetSensorColorFull(IN_2);
  8.  SetSensorLowspeed(IN_4);
  9.  unsigned int rawData[], normData[];
  10.  int scaledData[];
  11.  int cval;
  12.  long t0, time;
  13.  int rotations = 0;
  14.  
  15.  while (true) {
  16.    if(SensorUS(IN_4)<odlegloscOdPrzeszkody && SensorUS(IN_4)>0){
  17.      t0 = CurrentTick();
  18.      while(true){
  19.        ReadSensorColorEx(IN_2, cval, rawData, normData, scaledData);
  20.        if (cval == kraniecRingu) {
  21.          time = CurrentTick()-t0;
  22.          OnFwd(OUT_AC, 75); Wait(time);
  23.          Off(OUT_AC); Wait(100);
  24.          t0 = CurrentTick();
  25.          break;
  26.        } else {
  27.          OnRev(OUT_AC, 75); Wait(50);
  28.        }
  29.      }
  30.    }
  31.    else {
  32.      if(rotations<iloscObrotowDoPelnegoObrotu){
  33.        OnRev(OUT_A,60);
  34.        OnFwd(OUT_C,60);Wait(150);
  35.        Off(OUT_AC);Wait(100);
  36.        rotations+=1;
  37.      } else {
  38.       break;
  39.      }
  40.    }
  41.  }
  42. }
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