37 lines
498 B
C++
37 lines
498 B
C++
#pragma once
|
|
|
|
#include <Arduino.h>
|
|
#include <Servo.h>
|
|
|
|
#include <array>
|
|
|
|
#include "AbHal.hpp"
|
|
#include "DcMotor.hpp"
|
|
#include "Utils.hpp"
|
|
|
|
|
|
using TimeStamp = decltype(millis());
|
|
|
|
class ServoGrp {
|
|
public:
|
|
ServoGrp(int pin) : _pin(pin) {}
|
|
|
|
void attach() {
|
|
_srv.attach(_pin);
|
|
}
|
|
|
|
void detach() {
|
|
_srv.detach();
|
|
}
|
|
|
|
void write(int pos) {
|
|
_pos = pos;
|
|
_srv.write(_pos);
|
|
}
|
|
|
|
private:
|
|
Servo _srv;
|
|
int _pin;
|
|
int _pos{};
|
|
};
|