Adafruit Library
seesaw_servo.h
1 #ifndef _SEESAW_SERVO_H
2 #define _SEESAW_SERVO_H
3 
4 #include "Adafruit_seesaw.h"
5 
6 /**************************************************************************/
10 /**************************************************************************/
11 class seesaw_Servo {
12 
13 public:
14  /**************************************************************************/
19  /**************************************************************************/
21  _ss = ss;
22  _attached = false;
23  }
24 
25  ~seesaw_Servo() {}
26  bool begin(uint8_t addr = SEESAW_ADDRESS, int8_t flow = -1);
27 
28  uint8_t attach(int pin);
29  uint8_t attach(int pin, int min, int max);
30 
31  /**************************************************************************/
35  /**************************************************************************/
36  void detach() { _attached = false; }
37  void write(int value);
38  void writeMicroseconds(int value);
39  int read();
40 
41  /**************************************************************************/
46  /**************************************************************************/
47  int readMicroseconds() { return _sval / 3.2768; }
48 
49  /**************************************************************************/
54  /**************************************************************************/
55  bool attached() { return _attached; }
56 
57 private:
58  Adafruit_seesaw *_ss;
59  bool _attached;
60  uint16_t _sval;
61  uint8_t _pin;
62  uint16_t min;
63  uint16_t max;
64 };
65 
66 #endif
bool attached()
check if the servo is attached yet
Definition: seesaw_servo.h:55
Class that stores state and functions for seesaw servo interface.
Definition: seesaw_servo.h:11
void writeMicroseconds(int value)
Write pulse width in microseconds.
Definition: seesaw_servo.cpp:87
int readMicroseconds()
get current value in microseconds
Definition: seesaw_servo.h:47
int read()
get current value
Definition: seesaw_servo.cpp:79
Class that stores state and functions for interacting with seesaw helper IC.
Definition: Adafruit_seesaw.h:235
#define SEESAW_ADDRESS
Default Seesaw I2C address.
Definition: Adafruit_seesaw.h:31
bool begin(uint8_t addr=SEESAW_ADDRESS, int8_t flow=-1)
begin the seesaw. This is only necessary if the seesaw is not already started
Definition: seesaw_servo.cpp:15
uint8_t attach(int pin)
attach the given pin to the next free channel, sets pinMode.
Definition: seesaw_servo.cpp:27
seesaw_Servo(Adafruit_seesaw *ss)
class constructor
Definition: seesaw_servo.h:20
void detach()
set attached to false
Definition: seesaw_servo.h:36
void write(int value)
write a value. if value is < 200 its treated as an angle, otherwise as pulse width in microseconds ...
Definition: seesaw_servo.cpp:62