Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Task B testing
  2.  
  3. task main()
  4.  
  5. {
  6.  
  7. //Initial declarations.
  8. SetSensorTouch(IN_1);
  9. SetSensorLight(IN_3);
  10. int light = 58; dark = 48
  11. int power = 50;
  12. int part = 0;
  13.  
  14. while(SENSOR_1 == 0)
  15. {
  16.    //Loop while it finds the line.
  17.    while (part == 0)
  18.    {
  19.       //Loop when on white.
  20.       while(SENSOR_3 > dark)
  21.       {
  22.          OnFwdReg(OUT_BC, power);
  23.       }
  24.      
  25.       //Segment when it hits black.
  26.       RotateMotor(OUT-C, -power, 180);
  27.      
  28.    }
  29.    
  30.    //Loop after the line has been been found.
  31.    while (part == 1)
  32.    {
  33.       //PID & Timer goes here
  34.    }
  35.    
  36.    //Segment to stop.
  37.    while (part == 2)
  38.    {
  39.       Off(OUT_BC);
  40.    }
  41.    
  42.    
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement