MX-12W Servo Library

Dependents:   DISCO_L475VG_IOT01-Sensors-BSP

Committer:
tsoul
Date:
Fri Dec 11 09:10:36 2020 +0000
Revision:
1:d0c3878f77ee
Parent:
0:5e5d94ac9c80
Child:
2:b4d4c281f174
Allow read & write

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tsoul 0:5e5d94ac9c80 1 #ifndef MBED_MX12_H
tsoul 0:5e5d94ac9c80 2 #define MBED_MX12_H
tsoul 0:5e5d94ac9c80 3
tsoul 0:5e5d94ac9c80 4 #include "mbed.h"
tsoul 0:5e5d94ac9c80 5
tsoul 1:d0c3878f77ee 6 #define MX12_ANSWER_MAX_SIZE 32
tsoul 1:d0c3878f77ee 7
tsoul 0:5e5d94ac9c80 8 class MX12 {
tsoul 0:5e5d94ac9c80 9 public:
tsoul 0:5e5d94ac9c80 10 MX12(PinName tx, PinName rx, int baud=115200);
tsoul 0:5e5d94ac9c80 11
tsoul 0:5e5d94ac9c80 12 void SetSpeed(unsigned char mot_id, float speed);
tsoul 1:d0c3878f77ee 13 void PrintAnswer();
tsoul 0:5e5d94ac9c80 14
tsoul 1:d0c3878f77ee 15 void rw(unsigned char mot_id, char adress, char len, char *data);
tsoul 1:d0c3878f77ee 16
tsoul 1:d0c3878f77ee 17 void _ReadCallback();
tsoul 0:5e5d94ac9c80 18
tsoul 0:5e5d94ac9c80 19 private:
tsoul 0:5e5d94ac9c80 20 UnbufferedSerial _mx12;
tsoul 1:d0c3878f77ee 21
tsoul 1:d0c3878f77ee 22 char _res[MX12_ANSWER_MAX_SIZE];
tsoul 1:d0c3878f77ee 23 char _res_count;
tsoul 0:5e5d94ac9c80 24 int _baud;
tsoul 0:5e5d94ac9c80 25 };
tsoul 0:5e5d94ac9c80 26
tsoul 0:5e5d94ac9c80 27 #endif /* MBED_MX12_H */