mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
29 lines
462 B
C++
29 lines
462 B
C++
#pragma once
|
|
|
|
#include <Arduino.h>
|
|
#ifdef ESP8266
|
|
#include <Servo.h>
|
|
#else
|
|
#include <ESP32Servo.h>
|
|
#endif
|
|
|
|
struct Servo_t {
|
|
uint8_t num;
|
|
uint8_t pin;
|
|
Servo* obj;
|
|
Servo_t(uint8_t num, uint8_t pin) : num{num}, pin{pin}, obj{nullptr} {};
|
|
};
|
|
|
|
class Servos {
|
|
public:
|
|
Servos();
|
|
Servo* get(uint8_t num);
|
|
Servo* create(uint8_t num, uint8_t pin);
|
|
|
|
size_t count();
|
|
|
|
private:
|
|
std::vector<Servo_t> _items;
|
|
};
|
|
|
|
extern Servos myServo; |