Advertisement
timor2542

[4 DOF Robot Arm Keyestudio][Lab 06][ATX-2] 3 Servo First 3 Knob/Analog Test

Aug 2nd, 2021
910
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <ATX2.h>
  2. int x1, x2, x3;
  3. void setup(){
  4.   OK();
  5.   glcdClear();
  6.   glcdMode(1);
  7.   setTextSize(2);
  8.   glcd(1,1,"SV1:");
  9.   glcd(2,1,"SV2:");
  10.   glcd(3,1,"SV3:");
  11. }
  12. void loop(){
  13.  
  14.   x1 = knob(180);
  15.   x2 = map(analog(6), 0, 1023, 30, 90);
  16.   x3 = map(analog(7), 0, 1023, 30, 100);
  17.  
  18.   servo(1, x1);
  19.   servo(2, x2);
  20.   servo(3, x3);
  21.  
  22.   glcd(1,5," %d   ",x1);
  23.   glcd(2,5," %d   ",x2);
  24.   glcd(3,5," %d   ",x3);
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement