Hello, this is one of my first time working with arduino's. I am working with the parts in the image above, all the parts and code are listed in the linked website. I am wondering with specific code, does the wiring matter? I see in the photo that a single wire splits into many and coressponds into many places, is it ok If the wires come from different spots, or does the port matter? Thank you.
Also, how do you split wires like that?
As you have discovered, the picture represents connections, NOT individual wires that you try to duplicate. You can connect multiple wires by soldering, by using junction blocks with screws for wires or even stripping the ends of wires and soldering them together. Just make the "connections" as indicated.
Great Idea. The parts list shows only one UNO, why two. Using two dramatically complicates your project. This is a difficult project even with experience with the Arduino. I recommend you get the Arduino Cookbook, skim it cover to cover and try each of the projects that uses parts of your project, be sure you understand them.
What about the ground for arduino/driver/motor #2left?:
Ah-- I see, the code uses brain-dead blocking code in the arduinos, making the project so it needs one arduino per stepper motor:
// RightMotor.ino
/*
(Joystick)
left pin A1
right pin A0
up pin A3
down pin A2
(Right Motor)
pin 13
pin 12
pin 11
pin 10
*/
int leftpin = A1;
int rightpin = A0;
int uppin = A3;
int downpin = A2;
int leftvalue = 0;
int rightvalue = 0;
int upvalue = 0;
int downvalue = 0;
#include <Stepper.h>
const int stepsPerRevolution = 150;
Stepper rightStepper(stepsPerRevolution, 10, 11, 12, 13);
void setup() {
pinMode(leftpin, INPUT_PULLUP);
pinMode(rightpin, INPUT_PULLUP);
pinMode(uppin, INPUT_PULLUP);
pinMode(downpin, INPUT_PULLUP);
rightStepper.setSpeed(120);
Serial.begin(9600);
}
void setStepperIdle() {
digitalWrite(10, LOW);
digitalWrite(11, LOW);
digitalWrite(12, LOW);
digitalWrite(13, LOW);
}
void loop() {
leftvalue = digitalRead(leftpin);
rightvalue = digitalRead(rightpin);
upvalue = digitalRead(uppin);
downvalue = digitalRead(downpin);
if (leftvalue == LOW) {
rightStepper.step(stepsPerRevolution);
setStepperIdle();
Serial.print("left");
delay(10);
}
if (rightvalue == LOW) {
rightStepper.step(-stepsPerRevolution);
setStepperIdle();
Serial.print("right");
delay(10);
}
if (upvalue == LOW) {
rightStepper.step(stepsPerRevolution);
setStepperIdle();
Serial.print("up");
delay(10);
}
if (downvalue == LOW) {
rightStepper.step(-stepsPerRevolution);
setStepperIdle();
Serial.print("down");
delay(10);
}
}
and...
// LeftMotor.ino
/*
(Joystick)
left pin A1
right pin A0
up pin A3
down pin A2
(Left Motor)
pin 13
pin 12
pin 11
pin 10
*/
int leftpin = A1;
int rightpin = A0;
int uppin = A3;
int downpin = A2;
int leftvalue = 0;
int rightvalue = 0;
int upvalue = 0;
int downvalue = 0;
#include <Stepper.h>
const int stepsPerRevolution = 150;
Stepper leftStepper(stepsPerRevolution, 13, 12, 11, 10);
void setup() {
pinMode(leftpin,INPUT_PULLUP);
pinMode(rightpin,INPUT_PULLUP);
pinMode(uppin,INPUT_PULLUP);
pinMode(downpin,INPUT_PULLUP);
leftStepper.setSpeed(120);
Serial.begin(9600);
}
void setStepperIdle() {
digitalWrite(10, LOW);
digitalWrite(11, LOW);
digitalWrite(12, LOW);
digitalWrite(13, LOW);
}
void loop() {
leftvalue = digitalRead(leftpin);
rightvalue = digitalRead(rightpin);
upvalue = digitalRead(uppin);
downvalue = digitalRead(downpin);
if(leftvalue == LOW){
leftStepper.step(-stepsPerRevolution);
setStepperIdle();
Serial.print("left");
delay(10);}
if(rightvalue == LOW){
leftStepper.step(stepsPerRevolution);
setStepperIdle();
Serial.print("right");
delay(10);}
if(upvalue == LOW){
leftStepper.step(stepsPerRevolution);
setStepperIdle();
Serial.print("up");
delay(10);}
if(downvalue == LOW){
leftStepper.step(-stepsPerRevolution);
setStepperIdle();
Serial.print("down");
delay(10);}
}
The delay() is killing your project. Use the mils instead. Caution all the print statements can get you in trouble as they take processor time. Granted they are buffered but that is limited.
I'm not sure what you mean by delay, I am not very good working with code, sorry for not reading some of these responses, but I have read them now, thank you for your insight and help, I appreciate it.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.

