BasicMicroUK - Forums

www.basicmicro.co.uk
It is currently Sun Nov 19, 2017 11:33 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: RoboClaw Read Current Problem
PostPosted: Fri Apr 25, 2014 5:07 am 
Offline
New User

Joined: Tue Apr 08, 2014 12:21 am
Posts: 4
Hey, I used the command 49 in the packet serial mode of roboclaw to read the motor current. However, it keeps returning 00049, which means the current is 0. This is my code. And I also tried other command like read main battery voltage and it works. It seems only the read current command works abnormally.



static byte Input[5] = {};
static byte Input1[2]={128,49};
byte *Address = Input;
byte *CMD = &Input[1];
byte *DutyHigh = &Input[2];
byte *DutyLow = &Input[3];
byte *CheckSum = &Input[4];
byte buffer[5]={};

double TimeStep = 0.01;


void setup()
{
*Address = 128;
*CMD = 32;
Serial.begin(38400);
Serial1.begin(38400);

}

void loop()
{
int16_t Duty = 1000;
*DutyLow = Duty & 0x00FF;
*DutyHigh = (Duty & 0xFF00) >> 8;



*CheckSum = ( *Address + *CMD + *DutyHigh + *DutyLow ) & 0x7F;
Serial1.write(Input, sizeof(Input));
delay(1000);
Serial1.write(Input1, sizeof(Input1));
delay(1000);
Serial1.readBytes(buffer,sizeof(buffer));
delay(10);
Serial.print(buffer[0]);
Serial.print(buffer[1]);
Serial.print(buffer[2]);
Serial.print(buffer[3]);
Serial.print(buffer[4]);


delay(1000);


}


Top
 Profile  
 
 Post subject: Re: RoboClaw Read Current Problem
PostPosted: Thu May 08, 2014 3:31 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 7:00 pm
Posts: 1316
Location: Temecula, CA
Do you know approx the current draw of your motors? If they are too low(especially on older firmware) you may not get any reading(eg less than 1 amp). Newer firmware has improved this alot but the 2x5a has to be returned for firmware updates since it doesnt have a USB port.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO