ServoEasing
DummyServo.h
Go to the documentation of this file.
1 /*
2  * DummyServo.h
3  *
4  * Dummy servo library as example for a user provided servo library,
5  * which is activated by #define USE_USER_PROVIDED_SERVO_LIB.
6  *
7  * Copyright (C) 2024 Armin Joachimsmeyer
8  * armin.joachimsmeyer@gmail.com
9  *
10  * This file is part of ServoEasing https://github.com/ArminJo/ServoEasing.
11  *
12  * ServoEasing is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20  * See the GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <http://www.gnu.org/licenses/gpl.html>.
24  */
25 
26 /*
27  * We only require:
28  * Servo - Class for manipulating servo motors connected to Arduino pins.
29  * attach(pin, min, max) - Attaches to a pin setting min and max values in microseconds
30  * writeMicroseconds(value) - Sets the servo pulse width in microseconds
31  * detach() - Stops an attached servo from pulsing its i/o pin.
32  */
33 
34 #ifndef _DUMMY_SERVO_H
35 #define _DUMMY_SERVO_H
36 
37 #include <inttypes.h>
38 
39 class Servo
40 {
41 public:
42  Servo();
43  uint8_t attach(int pin, int min, int max); // as above but also sets min and max values for writes.
44  void detach();
45  void writeMicroseconds(int value); // Write pulse width in microseconds
46 
47 private:
48  /*
49  * Not used in this example
50  */
51  uint8_t servoPin;
52  int8_t min;
53  int8_t max;
54 };
55 
56 #endif // _DUMMY_SERVO_H
Servo
Definition: DummyServo.h:40
Servo::Servo
Servo()
Servo::writeMicroseconds
void writeMicroseconds(int value)
Servo::detach
void detach()
Servo::attach
uint8_t attach(int pin, int min, int max)