I want to control a stepper motor from a different Host than the Arduino (to enable me to prototype a project before making a PCB layout).
I purchased several stepper motor boards and stepper motors and
need the I2C information (Slave address and functions). Also a schematic so I can see where the PWM signals go.
Thanks in advance.
Regards
David
I2C information for Stepper Motor Shield
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- Franklin97355
- Posts: 23940
- Joined: Mon Apr 21, 2008 2:33 pm
Re: I2C information for Stepper Motor Shield
Take a look at the motor library for the codes sent to the shield https://github.com/adafruit/Adafruit-Mo ... ld-library
- orbitcoms
- Posts: 20
- Joined: Sun May 19, 2013 3:11 am
Re: I2C information for Stepper Motor Shield
Which file contains the I2C slave address and functions? I am not up much on Arduino?
This is the code I found so far...
This is the code I found so far...
Code: Select all
#include <AccelStepper.h>
#include <AFMotor.h>
// two stepper motors one on each port
AF_Stepper motor1(200, 1);
AF_Stepper motor2(200, 2);
// you can change these to DOUBLE or INTERLEAVE or MICROSTEP!
// wrappers for the first motor!
void forwardstep1() {
motor1.onestep(FORWARD, SINGLE);
}
void backwardstep1() {
motor1.onestep(BACKWARD, SINGLE);
}
// wrappers for the second motor!
void forwardstep2() {
motor2.onestep(FORWARD, SINGLE);
}
void backwardstep2() {
motor2.onestep(BACKWARD, SINGLE);
}
// Motor shield has two motor ports, now we'll wrap them in an AccelStepper object
AccelStepper stepper1(forwardstep1, backwardstep1);
AccelStepper stepper2(forwardstep2, backwardstep2);
void setup()
{
stepper1.setMaxSpeed(200.0);
stepper1.setAcceleration(100.0);
stepper1.moveTo(24);
stepper2.setMaxSpeed(300.0);
stepper2.setAcceleration(100.0);
stepper2.moveTo(1000000);
}
void loop()
{
// Change direction at the limits
if (stepper1.distanceToGo() == 0)
stepper1.moveTo(-stepper1.currentPosition());
stepper1.run();
stepper2.run();
}
Last edited by adafruit_support_bill on Sun Mar 01, 2015 8:34 am, edited 1 time in total.
Reason: please use the </> button when submitting code. press </>, then paste your code between the [code] [/code] tags.
Reason: please use the </> button when submitting code. press </>, then paste your code between the [code] [/code] tags.
- adafruit_support_bill
- Posts: 88154
- Joined: Sat Feb 07, 2009 10:11 am
Re: I2C information for Stepper Motor Shield
That is the multi-stepper example code. The library code is in the link posted above:
https://github.com/adafruit/Adafruit_Mo ... V2_Library
https://github.com/adafruit/Adafruit_Mo ... V2_Library
- orbitcoms
- Posts: 20
- Joined: Sun May 19, 2013 3:11 am
Re: I2C information for Stepper Motor Shield
I navigated to the site and downloaded the AFMotor_ConstantSpeed.pde under the MultiStepper examples but cannot see the I2C code in there?
- adafruit_support_bill
- Posts: 88154
- Joined: Sat Feb 07, 2009 10:11 am
Re: I2C information for Stepper Motor Shield
AF_Motor is for V1 shields. You want the V2 library:
https://github.com/adafruit/Adafruit_Mo ... V2_Library
https://github.com/adafruit/Adafruit_Mo ... V2_Library
- orbitcoms
- Posts: 20
- Joined: Sun May 19, 2013 3:11 am
Re: I2C information for Stepper Motor Shield
That's where I went, which file to I download?
- Franklin97355
- Posts: 23940
- Joined: Mon Apr 21, 2008 2:33 pm
Re: I2C information for Stepper Motor Shield
Adafruit_MotorShield.cpp if all you want to do is look at the code. If you want the library download the zip file.
- adafruit_support_bill
- Posts: 88154
- Joined: Sat Feb 07, 2009 10:11 am
Re: I2C information for Stepper Motor Shield
Really? There are no AF_Motor files or .pde files of any kind under that link. The files you want are the library files which are right there at the top levelThat's where I went, which file to I download?
Adafruit_MotorShield.cpp
and
Adafruit_MotorShield.h
Please be positive and constructive with your questions and comments.