Reply to topic  [ 14 posts ]  Go to page Previous  1, 2
HCMotor Arduino library for driving DC and stepper motors. 
Author Message
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 767
Post Re: HCMotor Arduino library for driving DC and stepper motor
I'm afraid the HCMotor library doesn't have a clock (step) multiplier feature. Mainly as that's not what the library is intended for. Also a TB6560 can only divide down a clock. I believe you need to multiply up your clock by a factor of 8 (?). Depending on your maximum step frequency you'd probably be able to do it with something like an Uno but you'll need a clock multiplier / PLL sketch to do achieve this.

_________________
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.


Mon Jan 29, 2018 10:23 am
Profile

Joined: Wed Mar 14, 2018 10:28 pm
Posts: 2
Post Re: HCMotor Arduino library for driving DC and stepper motor
Hi Andrew, I want to know how to use this code control 4 stepper motors? how to define more then one CLK_PIN in code?
Thanks :D


Thu Mar 15, 2018 4:31 pm
Profile
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 767
Post Re: HCMotor Arduino library for driving DC and stepper motor
You can use the HCMotor.attach() function to add more motors (default maximum is 4 motors) like this:

#define MOTOR_PIN0 7
#define MOTOR_PIN1 8
#define MOTOR_PIN2 9
#define MOTOR_PIN3 10

HCMotor.attach(0, STEPPER, MOTOR_PIN0);
HCMotor.attach(1, STEPPER, MOTOR_PIN1);
HCMotor.attach(2, STEPPER, MOTOR_PIN2);
HCMotor.attach(3, STEPPER, MOTOR_PIN3);

From then on when you use any other of the library functions just set the MotorNum parameter to a value of either 0, 1, 2, or 3 depending on which motor you want it to apply to. E.g.

HCMotor.Direction(2, FORWARD);

Sets motor number 2 to the forward direction.

_________________
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.


Fri Mar 16, 2018 11:24 am
Profile

Joined: Wed Mar 14, 2018 10:28 pm
Posts: 2
Post Re: HCMotor Arduino library for driving DC and stepper motor
very helpful. Thanks Andrew!!


Fri Mar 16, 2018 10:00 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 14 posts ]  Go to page Previous  1, 2

Who is online

Users browsing this forum: No registered users and 2 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

Search for:
Jump to:  
Thank you to phpBB.com & phpBB.ro.
Design created by Florea Cosmin Ionut.
© 2011 All contents of this site are © Hobby Components LTD