Advertisement
djazz

NXC - Explorer

Sep 9th, 2012
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.69 KB | None | 0 0
  1.  
  2.  
  3. task main() {
  4.     SetSensorLowspeed(IN_1);
  5.     SetSensorLowspeed(IN_4);
  6.  
  7.     while (true) {
  8.        
  9.         if (SensorUS(IN_4) < 15) {
  10.             if (SensorUS(IN_1) > 25) {
  11.                 OnFwd(OUT_BC, 50);
  12.                 Wait(400);
  13.                 OnRev(OUT_C, 50);
  14.                 Wait(800);
  15.             } else {
  16.                 OnFwd(OUT_BC, 50);
  17.                 Wait(600);
  18.                 OnRev(OUT_C, 50);
  19.                 Wait(1400);
  20.             }
  21.         } else if (SensorUS(IN_1) < 15) {
  22.             if (SensorUS(IN_4) > 25) {
  23.                 OnFwd(OUT_BC, 50);
  24.                 Wait(400);
  25.                 OnRev(OUT_B, 50);
  26.                 Wait(800);
  27.             } else {
  28.                 OnFwd(OUT_BC, 50);
  29.                 Wait(600);
  30.                 OnRev(OUT_B, 50);
  31.                 Wait(1400);
  32.             }
  33.         } else {
  34.             OnRev(OUT_BC, 50);
  35.         }
  36.     }
  37.  
  38.     //ClearScreen();
  39.     //TextOut(15, LCD_LINE1, "Display", true);
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement