HELLO
new with arduino, as an art student, forum pros I need your help with code!
connected: arduino uno + adafruit motor shield + 2 stepper motors + sound sensor
( i have two sensors one for each motor)..
HELLO
new with arduino, as an art student, forum pros I need your help with code!
connected: arduino uno + adafruit motor shield + 2 stepper motors + sound sensor
( i have two sensors one for each motor)..
To make it easy for people to help you please modify your post and use the code button </>
so your code looks like this
and is easy to copy to a text editor. See How to use the Forum
Your code is too long for me to study quickly without copying to my text editor. The text editor shows line numbers, identifies matching brackets and allows me to search for things like all instances of a particular variable or function.
Also please use the AutoFormat tool to indent your code for easier reading.
Have you a simple program that makes the stepper motors move properly?
Please post the program that represents your best attempt at merging the programs and tell us what it actually does and what you want it to do that is different.
kemanius:
Oh sorry (added code) and thank You for info about motors
You have not told us what the combined code does when you run it.
...R
You don't seem to have stepper.run() or runSpeed() anywhere in the program. Use run() if you need acceleration. Otherwise use runSpeed(). You need to add these two lines as the last thing in loop()
stepper1.runSpeed();
stepper2.runSpeed();
You must NOT use delay() with the Acclestepper library.
Spend an hour or three carefully studying the examples that come with the AccelStepper library.
I don't think you need any of these lines
#include <AFMotor.h>
#include <Stepper.h>
AF_Stepper motor1(200, 1);
AF_Stepper motor2(200, 2);
int pos = 0;
int PIN_ANALOG_IN = A0;
void forwardstep1() {
motor1.onestep(FORWARD, SINGLE);
}
void backwardstep1() {
motor1.onestep(BACKWARD, SINGLE);
}
void forwardstep2() {
motor2.onestep(FORWARD, SINGLE);
}
void backwardstep2() {
motor2.onestep(BACKWARD, SINGLE);
}
...R
You can't simply combine code that is written for the Stepper library with code for the far more sophisticated Accelstepper library.
...R