Advertisement
RybaSG

Untitled

Oct 2nd, 2018
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.53 KB | None | 0 0
  1. if ( Yaxis >= 130 && Xaxis < 130 && Xaxis > 120  )      // go forward, both axes has value from Yaxis
  2. {
  3.     MotorsDirection(BothAxes, FORWARD);                 // Both axes goes forward
  4.  
  5.     LeftPWMBuffer = map(Yaxis, 130, 255, 0, 255);
  6.  
  7.     LastActualLeftDiff = LeftPWMBuffer - LastLeftPWM;
  8.  
  9.     if ( LastActualLeftDiff > 0 )
  10.     {
  11.         for ( incr = LastLeftPWM; incr <= LastLeftPWM + LastActualLeftDiff - 1 ; incr++ )
  12.         {
  13.             _delay_ms(10);
  14.             PORTA ^= (1<<PA7);
  15.             LeftPWM = incr;
  16.         }
  17.     }
  18.     else
  19.     {
  20.         LeftPWM  = LeftPWMBuffer;
  21.     }
  22. }
  23.  
  24. LastLeftPWM = LeftPWM;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement