Advertisement
ChaOSzz

Untitled

Mar 20th, 2022
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   int horz = analogRead(HORZ_PIN);
  2.   int vert = analogRead(VERT_PIN);
  3.   if (vert < 300) {
  4.     y = min(y + 1, maxY);
  5.   }
  6.   if (vert > 700) {
  7.     y = max(y - 1, 0);
  8.   }
  9.   if (horz > 700) {
  10.     x = min(x + 1, maxX);
  11.   }
  12.   if (horz < 300) {
  13.     x = max(x - 1, 0);
  14.   }
  15.   if (digitalRead(SEL_PIN) == LOW) {
  16.     mx.clear();
  17.   }
  18.   mx.setPoint(y, x, true);
  19.   mx.update();
  20.   delay(100);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement