Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: MX12.cpp
- Revision:
- 24:2ab26ed08c83
- Parent:
- 22:8fa806e3ece4
- Child:
- 26:4632a02a8ef1
--- a/MX12.cpp Sun Nov 07 11:35:16 2021 +0000
+++ b/MX12.cpp Sat Nov 13 10:12:09 2021 +0100
@@ -62,6 +62,22 @@
rw(mot_id, CONTROL_TABLE_MOVING_SPEED, 2, data);
}
+void MX12::SetSpeed_rad_s(unsigned char mot_id, float speed)
+{
+ if (speed > MX12_ABSOLUTE_MAX_SPEED_RAD_S)
+ {
+ SetSpeed(mot_id, 1);
+ }
+ else if (speed < -MX12_ABSOLUTE_MAX_SPEED_RAD_S)
+ {
+ SetSpeed(mot_id, -1);
+ }
+ else
+ {
+ SetSpeed(mot_id, speed / MX12_ABSOLUTE_MAX_SPEED_RAD_S);
+ }
+}
+
char MX12::IsAvailable(void) {
return (_bus_state == SerialState::Idle);
}