Advertisement
timor2542

[4 DOF Robot Arm Keyestudio][Lab 05][ATX-2] Gripper Switch Test

Aug 2nd, 2021
878
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <ATX2.h>
  2. #define SV4_OPEN_ANGLE 165
  3. #define SV4_CLOSE_ANGLE 85
  4. void setup(){
  5.   OK();
  6.   glcdClear();
  7.   glcdMode(1);
  8.   setTextSize(2);
  9.   glcd(1,3,"Gripper");
  10.   glcd(2,1,"Switch Test");
  11.   setTextSize(4);
  12. }
  13. void loop(){
  14.   if(in(28) == 0 && in(29) == 1)
  15.   {
  16.     servo(4, SV4_OPEN_ANGLE);
  17.     setTextColor(GLCD_GREEN);
  18.     glcd(2,1,"OPEN ");
  19.   }
  20.   else if(in(28) == 1 && in(29) == 0)
  21.   {
  22.     servo(4, SV4_CLOSE_ANGLE);
  23.     setTextColor(GLCD_RED);
  24.     glcd(2,1,"CLOSE");
  25.   }
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement