MatrixMiniR4 1.1.5
Matrix Mini R4 Arduino Library API Documentation
Loading...
Searching...
No Matches
MiniR4RC.h
Go to the documentation of this file.
1
6#ifndef MINIR4RC_H
7#define MINIR4RC_H
8
9#include "MMLower.h"
10
21template<uint8_t ID> class MiniR4RC
22{
23public:
24 MiniR4RC() { _id = ID; }
25
33 bool begin(void)
34 {
35 MMLower::RESULT result = mmL.SetServoAngleRange(_id, 0, 180);
36 return (result == MMLower::RESULT::OK);
37 }
38
45 bool setHWDir(bool dir)
46 {
48 MMLower::RESULT result = mmL.SetServoDir(_id, _dir);
49 return (result == MMLower::RESULT::OK);
50 }
51
60 bool setAngle(uint16_t angle)
61 {
62 MMLower::RESULT result = mmL.SetServoAngle(_id, angle);
63 return (result == MMLower::RESULT::OK);
64 }
65
66private:
67 uint8_t _id;
68};
69
70#endif // MINIR4RC_H
MMLower mmL(8, 9, 57600)
Handling the Lower MCU (STM32) communication.
RESULT SetServoAngleRange(uint8_t num, uint16_t min, uint16_t max)
Definition MMLower.cpp:179
RESULT SetServoAngle(uint8_t num, uint16_t angle)
Definition MMLower.cpp:472
RESULT SetServoDir(uint8_t num, DIR dir)
Definition MMLower.cpp:87
A class for controlling a remote control (RC) servo.
Definition MiniR4RC.h:22
bool setAngle(uint16_t angle)
Sets the angle of the servo.
Definition MiniR4RC.h:60
MiniR4RC()
Definition MiniR4RC.h:24
bool setHWDir(bool dir)
Sets the hardware direction of the servo.
Definition MiniR4RC.h:45
bool begin(void)
Initializes the servo with a default angle range.
Definition MiniR4RC.h:33