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.
Dependents: Nucleo_robot_2ndaire
Fork of AX12 by
Revision 1:40bc0469fd51, committed 2015-04-11
- Comitter:
- sype
- Date:
- Sat Apr 11 16:07:29 2015 +0000
- Parent:
- 0:db8f063d50f0
- Commit message:
- okay
Changed in this revision
| AX12.cpp | Show annotated file Show diff for this revision Revisions of this file |
| AX12.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/AX12.cpp Wed Oct 05 12:08:21 2011 +0000
+++ b/AX12.cpp Sat Apr 11 16:07:29 2015 +0000
@@ -264,6 +264,17 @@
return (angle);
}
+int AX12::GetSpeed(void) {
+
+ printf("\nGetSpeed(%d)",_ID);
+
+ char data[2];
+
+ int ErrorCode = read(_ID, 0x26, 2, data);
+ int position = data[0] + (data[1] << 8);
+
+ return (position);
+}
float AX12::GetTemp (void) {
--- a/AX12.h Wed Oct 05 12:08:21 2011 +0000
+++ b/AX12.h Sat Apr 11 16:07:29 2015 +0000
@@ -42,6 +42,7 @@
#define AX12_REG_TEMP 0x2B
#define AX12_REG_MOVING 0x2E
#define AX12_REG_POSITION 0x24
+#define AX12_REG_SPEED 0x26
#define AX12_MODE_POSITION 0
#define AX12_MODE_ROTATION 1
@@ -121,7 +122,8 @@
* 1.0 = full speed clock wise
*/
int SetCRSpeed(float speed);
-
+
+ int GetSpeed(void);
/** Set the clockwise limit of the servo
*
@@ -186,7 +188,7 @@
private :
- SerialHalfDuplex _ax12;
+ Serial _ax12;
int _ID;
int _baud;
