yanuarf / slide-33

Automatically exported from code.google.com/p/slide-33
0 stars 0 forks source link

Read data from servo #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Thank you for the best Dynamixel MX-28 library in the Web.
I'm trying run this code on Arduino Mega
Write command works perfect through the TX3 & RX3 (I replaced all Serial. to 
Serial3. in Dynamixel_Serial.cpp ;))

I'm using 74LS241, with 100% correct circuit. pretty sure something wrong with 
timings...

my code is flowing:

#include <Dynamixel_Serial3.h>       // Library needed to control Dynamixal 
servo

#define SERVO_ID 0x03               // ID of which we will set Dynamixel too 
#define SERVO_ControlPin 7       // Control pin of buffer chip, NOTE: this does 
not matter becasue we are not using a half to full contorl buffer.
#define SERVO_SET_Baudrate 1000000    // Baud rate speed which the Dynamixel 
will be set too (57600)
#define CW_LIMIT_ANGLE 0x001        // lowest clockwise angle is 1, as when set 
to 0 it set servo to wheel mode
#define CCW_LIMIT_ANGLE 0xFFF       // Highest anit-clockwise angle is 0XFFF, 
as when set to 0 it set servo to wheel mode

void setup() {
   Serial.begin(9600);
   delay(1000);                                                           // Give time for Dynamixel to start on power-up
   Dynamixel.begin(SERVO_SET_Baudrate,SERVO_ControlPin,100);
   delay(10);
   Dynamixel.setStatusPaket(SERVO_ID,READ);                      // Tell Dynamixel only to return read status packets, this is done to limit the about of data on the Half duplex line.
   delay(10);
   Dynamixel.setStatusPaketReturnDelay(SERVO_ID,50);             // Tell Dynamixel when it does send a status packet return it  50 millis() affer instuction packet
   delay(10);
   Dynamixel.setMode(SERVO_ID, SERVO, CW_LIMIT_ANGLE, CCW_LIMIT_ANGLE);    // set mode to SERVO and set angle limits
   delay(10);
   Dynamixel.setHoldingTorque(SERVO_ID, OFF);                   // Disable Dynamixel holding torque
   delay(10);
   Dynamixel.setAlarmShutdown(SERVO_ID, 0x7F);                  // Set all Alarms to active on Dynamixel

}

void loop() {
  Serial.println(Dynamixel.readPosition(SERVO_ID),HEX);
  delay(2000);
}

My serial output like this:
F004
F0FF
F080
F004
F080
F0AD
F080
F080
0
F080

Please please help. I spend so much time and now fill depressed :(

Original issue reported on code.google.com by txyz.i...@gmail.com on 4 Mar 2013 at 6:23

GoogleCodeExporter commented 8 years ago
attached pic.
logic analyzer screenshot. with ^ runing code

Original comment by Chlen.Ni...@gmail.com on 4 Mar 2013 at 6:13

Attachments:

GoogleCodeExporter commented 8 years ago
Tacking back my words.
It's another shity Dynamixel Library.

Impossible read data from servo, bugs in code?

No support!

Original comment by Chlen.Ni...@gmail.com on 4 Apr 2013 at 11:21

GoogleCodeExporter commented 8 years ago
Snap! you are free to edit code as it is opensource.

Please note that I am not a business so there is no real support.

Original comment by j...@teda.id.au on 21 Apr 2013 at 8:49

GoogleCodeExporter commented 8 years ago
Version 2.1 has been tested and works, so if you are having issues reading then 
it is a connection error

Original comment by j...@teda.id.au on 21 Apr 2013 at 8:51