Advertisement
alseambusher

Untitled

Sep 19th, 2024
709
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <Servo.h>
  2.  
  3. class PanAndTilt {
  4. public:
  5.     void setup(int port_pan, int port_tilt) {
  6.         m_pan_servo.write(0);
  7.         m_tilt_servo.write(0);
  8.         m_pan_servo.attach(port_pan);
  9.         m_tilt_servo.attach(port_tilt);
  10.     }
  11.  
  12.     void pan(int value) {
  13.        m_pan_servo.write(value);
  14.     }
  15.  
  16.     void tilt(int value) {
  17.        m_tilt_servo.write(value);
  18.     }
  19. private:
  20.     Servo m_pan_servo, m_tilt_servo;
  21. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement