Hi, this is my first post hope it is in the right place.
I built a wire bender based off of this website. DIY Arduino based 2D wire bending machine - Electric DIY Lab I am using a cnc shield so the pins werent correct in the original program. I added the proper lines according to chatgpt. I also added the enable pins as per chatgpt.
The terminal or whatever its called in Arduino shows that it has run the program but the motors never move. Any insight would be appreciated.
Hardware is as follows.
BSROBOTICS # UNO R3 Board ATmega328P with USB Cable(Arduino-Compatible) for Arduino, Input Voltage 7-12V, 16MHZ,14 Digital 1/0 pins Support PWM, SRAW 2KB, Compatible with RPi 4B/3B+/3B/2B/B+/Zero/Zero W
CNC Shield is HiLetgo 2pcs A4988 V3 Engraver Drive Shield 3D Printer CNC Drive Expansion Board for Arduino 3D Printer CNC
Not sure what stepper drivers I have they were parts I had laying around from other builds.
This is the code
#include <Arduino.h>
#include "BasicStepperDriver.h"
#define Feed_step 200
#define Bend_step 200
#define Feed_RPM 80
#define Bend_RPM 30
#define MICROSTEPS 16
#define FEEDSTEPS 8
int Delay = 50;
#define Feed_DIR 6 // Y‑DIR on shield
#define Feed_STEP 3 // Y‑STEP
#define Bend_DIR 5 // X‑DIR
#define Bend_STEP 2 // X‑STEP
#define ENABLE_PIN 8 // common EN on the shield
int val = 0;
int data = 0;
int a = 0;
int b = 0;
int c = 0;
BasicStepperDriver Feed_stepper(Feed_step, Feed_DIR, Feed_STEP, ENABLE_PIN);
BasicStepperDriver Bend_stepper(Bend_step, Bend_DIR, Bend_STEP, ENABLE_PIN);
void setup() {
Serial.begin(9600);
Feed_stepper.begin(Feed_RPM, MICROSTEPS);
Bend_stepper.begin(Bend_RPM, MICROSTEPS);
Feed_stepper.enable(); // keep the drivers enabled
Bend_stepper.enable();
Serial.println("For Triangle enter (1,Side Length) ");
Serial.println("For Square enter (2,Side Length) ");
Serial.println("For Rectangle enter (3,Height,Length) ");
Serial.println( "For Hexagon enter (4,Side Length) ");
Serial.println( "For Spring enter (5,Spring Length) ");
Serial.println( "**Note Enter value without bracket ");
}
void loop() {
if (Serial.available()>0){
a = Serial.parseInt();
b = Serial.parseInt();
c = Serial.parseInt();
}
if (a == 1){
Serial.println(" ");
Serial.print("Making Triangle of side Length ");
Serial.print(b);
Serial.println("mm");
for (int x=0; x<3; x++){
Serial.println("..");
Feed_stepper.move(FEEDSTEPS*b*MICROSTEPS);
delay(Delay);
Bend_stepper.rotate(95);
delay(Delay);
Bend_stepper.rotate(-95);
}
Feed_stepper.move(FEEDSTEPS*15*MICROSTEPS);
Serial.println("Finish ");
a = 0;
b = 0;
}
if (a == 2){
Serial.println(" ");
Serial.print("Making Square of side Length ");
Serial.print(b);
Serial.println("mm");
for (int x=0; x<4; x++){
Serial.println("..");
Feed_stepper.move(FEEDSTEPS*b*MICROSTEPS);
delay(Delay);
Bend_stepper.rotate(75);
delay(Delay);
Bend_stepper.rotate(-75);
}
Feed_stepper.move(FEEDSTEPS*15*MICROSTEPS);
Serial.println("Finish ");
a = 0;
b = 0;
}
if (a == 3){
Serial.println(" ");
Serial.print("Making Rectangle of Length & Height ");
Serial.print(b);
Serial.print(" & ");
Serial.print(c);
Serial.println(" mm");
Serial.println("..");
for (int x=0; x<2; x++){
Feed_stepper.move(FEEDSTEPS*b*MICROSTEPS);
delay(Delay);
Bend_stepper.rotate(75);
delay(Delay);
Bend_stepper.rotate(-75);
delay(Delay);
Feed_stepper.move(FEEDSTEPS*c*MICROSTEPS);
delay(Delay);
Bend_stepper.rotate(75);
delay(Delay);
Bend_stepper.rotate(-75);
}
Feed_stepper.move(FEEDSTEPS*15*MICROSTEPS);
Serial.println("Finish ");
a = 0;
b = 0;
}
if (a == 4){
Serial.println(" ");
Serial.print("Making Hexagon of Side Length ");
Serial.print(b);
Serial.println("mm");
for (int x=0; x<5; x++){
Serial.println("..");
Feed_stepper.move(FEEDSTEPS*b*MICROSTEPS);
delay(Delay);
Bend_stepper.rotate(70);
delay(Delay);
Bend_stepper.rotate(-70);
}
Feed_stepper.move(FEEDSTEPS*15*MICROSTEPS);
Serial.println("Finish ");
a = 0;
b = 0;
}
if (a == 5){
Serial.println(" a==5 ");
Serial.print("Making Spring of Length ");
Serial.print(b);
Serial.println("mm");
for (int x=0; x<b*5; x++){
Serial.println("..");
Feed_stepper.move(360);
delay(Delay);
Bend_stepper.rotate(60);
delay(Delay);
Bend_stepper.rotate(-60);
}
Feed_stepper.move(FEEDSTEPS*15*MICROSTEPS);
Serial.println("Finish ");
a = 0;
b = 0;
}
}