Hi there,
I have a project which uses a NEMA17 stepper motor, plus a servo motor. As part of the NEMA17 bundle bought online came a uStepper S-Lite. It's meant to be like a combined arduino and H-bridge for the stepper motor, with extra pins for other stuff. It actually looks pretty neat if I can get it all working. The board/pin layout can be found by scrolling down here...
After a while, I got my stepper motor working on the uStepper S-Lite board using this simple code:
#include <uStepperSLite.h>
#define MAXACCELERATION 50000 //Max acceleration = 50000 Steps/s^2
#define MAXVELOCITY 25000 //Max velocity = 25000 steps/s
uStepperSLite stepper(MAXACCELERATION, MAXVELOCITY);
void setup() {
stepper.setup();
}
void loop() {
stepper.moveSteps (16398, CCW, HARD);
delay( 2000);
stepper.moveSteps (16398, CW, HARD);
delay( 2000);
}
I've also got a servo motor running on the arduino using this standard, simple code:
#include <Servo.h>
Servo servo1;
int pos1 = 0;
void setup(){
servo1.attach(9);
}
void loop(){
for(pos1 = 0 ; pos1 < 180; pos1 += 1){
servo1.write(pos1);
delay(10);
}
for(pos1 = 180; pos1 >= 1; pos1 -= 1){
servo1.write(pos1);
delay(10);
}
}
All good so far!
Now, I'm trying (and failing) to bring together the codes to run both motors from the uStepper S-Lite board. From the board layout, I've located the 5v and Ground pins. I'm trying to use pin D6 for the servo signal wire, as i used a digital pin to control from the arduino. (I guessing it should be using servo1.attach(6) not servo1.attach(D6))
This was the code I came up with (e.g. run the stepper motor back and forth, then move the servo).
#include <uStepperSLite.h>
#include <Servo.h>
#define MAXACCELERATION 50000 //Max acceleration = 50000 Steps/s^2
#define MAXVELOCITY 25000 //Max velocity = 25000 steps/s
uStepperSLite stepper(MAXACCELERATION, MAXVELOCITY);
Servo servo1;
int pos1 = 0;
void setup() {
// put your setup code here, to run once:
stepper.setup();
servo1.attach(6);
}
void loop() {
// put your main code here, to run repeatedly:
stepper.moveSteps (16398, CCW, HARD);
delay( 2000);
stepper.moveSteps (16398, CW, HARD);
delay( 2000);
for(pos1 = 0 ; pos1 < 180; pos1 += 1){
servo1.write(pos1);
delay(10);
}
for(pos1 = 180; pos1 >= 1; pos1 -= 1){
servo1.write(pos1);
delay(10);
}
}
I get nowt. It fails to compile and I get this error message:
libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function `ServoCount':
(.text+0x0): multiple definition of `__vector_11'
libraries\uStepper_S-lite\uStepperSLite.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board uStepper S-lite.
Thanks for taking the time to read this. Any ideas y'all?
p.s. Not expecting it to work, I did try pasting #include <uStepperSLite.h> at the top of the arduino/servo code and it gave me the exact same error.