Hi… complete newbie here, so thanks for adding me to forum. The site is full of great info…
I am trying to run a stepper motor, with Easy Driver and Arduino UNO clone. I have the motor wired up as per the sketches in the basic wiring sketch, and have tried to upload the first section of code on the page, which is as follows:
//Declare pin functions on RedBoard
#define stp 2
#define dir 3
#define MS1 4
#define MS2 5
#define EN 6
//Declare variables for functions
char user_input;
int x;
int y;
int state;
void setup() {
pinMode(stp, OUTPUT);
pinMode(dir, OUTPUT);
pinMode(MS1, OUTPUT);
pinMode(MS2, OUTPUT);
pinMode(EN, OUTPUT);
resetEDPins(); //Set step, direction, microstep and enable pins to default states
Serial.begin(9600); //Open Serial connection for debugging
Serial.println(“Begin motor control”);
Serial.println();
//Print function list for user selection
Serial.println(“Enter number for control option:”);
Serial.println(“1. Turn at default microstep mode.”);
Serial.println(“2. Reverse direction at default microstep mode.”);
Serial.println(“3. Turn at 1/8th microstep mode.”);
Serial.println(“4. Step forward and reverse directions.”);
Serial.println();
}
Firstly for some reason I get this error:
Arduino: 1.8.13 (Windows Store 1.8.39.0) (Windows 10), Board: “Arduino Uno”
C:\Users\ianya\AppData\Local\Temp\cc9b5P7b.ltrans0.ltrans.o: In function `main’:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.39.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/main.cpp:46: undefined reference to `loop’
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Uno.
This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.
Secondly, to run this code, do I need a terminal of some sort to enter the requested values in the last section of the sketch??? Is this necessary, can it be removed for a simple “run” command or something?
The truth is, I am complete novice to arduino/steppers… tho I control them somewhat on my 3D printer.
This project is just to start the motor and run it very slowly (10rpm) till it hits a limit switch, then reverse direction for a fixed amount, then returning again to the switch and repeat. The stepper just turns a M8 rod, followed by a nut.
i have photo’s but the page gives me a HTTP error when I upload.
I have checked all the wiring and solder joints, which are all good.
Any help would be fab!