Help with coding

Hello everyone.

This is my first post on this forum so I hope I got the topic right.

Im seeking help for programing my device. I already coded basic codes in Arduino IDE, but for what Im trying to do its too much foe a newbie like me.

I would like to run 2 stepper motor, one at the time. NEMA 17 and NEMA 23. I would like to run them in AUTO mode and MANUAL mode with joystick.

Im using:
Arduino UNO
CNC shield V3
A4988 stepper motor driver for NEMA 17
TB6600 stepper motor driver for NEMA 23
Limit switch for homing NEMA 17 at destination A
Inductive sensor for turning back NEMA 17 at destination B.
2 axis joystick
Emergency stop button
ON/OFF/ON button for, toggle betwen AUTO/OFF/MANUAL mode
SET button for homing
RUN button for begin
Potenciometer for adjusting NEMA 17 speed
Some sort of display to monitor NEMA 17 speed

NEMA 17 motor will move linear rail from A to B.
NEMA 23 will rotate gears.

Here is my logic for AUTO operation

  1. Pressing ON/OFF/ON switch in AUTO mode (board starts).
  2. Pressing SET button and NEMA 17 moves to limit switch to point A and this is starting point.
  3. By pressing RUN button NEMA 17 will move linear rail towards point B.
  4. When Inductive sensor will lost a signal NEMA 17 will stop.
  5. NEMA 23 will rotate for 180 degrees.
  6. NEMA 17 will move back to the starting point
  7. NEMA 23 will rotate for 60 degrees
  8. NEMA 17 will move again towards point B and stop
  9. NEMA 23 will rotate again for 180 degrees
  10. NEMA 17 moves back for starting point.

This Is alrerady complicated for me to write down a logic.

I would like to control all these moves also in MANUAL mode with joystick

This is a simulation of a device I like to controlt. It is not exact simulation as logic written above, but you ll get a prespective what I want.

Thank you so much in advance for all help.

Just hope all this make some sense

Kind regards


Thank you so much in advance for all help.

It's not clear what part you want help with.

If you just want someone to write a program for you please ask in the Gigs and Collaborations section of the Forum and be prepared to pay.

If you want to learn to program yourself then please post the program that represents your best attempt and tell us in detail what it actually does and what you want it to do that is different. That way we can focus on the parts you need help with rather than wasting time on things that you can do.

The following links may help.

Stepper Motor Basics
Simple Stepper Code
AccelStepper library

Several Things at a Time
Planning and Implementing a Program

What are you doing, reinventing the Cylinder Phonograph ?
That is quite an ambitious project for a beginner. Assuming that the choice of components is appropriate for the task you have outlined, you could start with simple sketches, each dedicated to testing an individual hardware components. For example, a sketch to read the joy stick and print the XY readings to the serial monitor, or a sketch to operate a stepper motor. Once you have got some basic familiarity with the basic components, start combining sections of it.

Of course, it is a hobby development and will be an interesting learning experience.


post crossed with @Robin2

Thanks for all feedback.
This is device for ultaconic measurement of steel rod.

I have allready written a code for some actions separately, but when Im combine them together all I get are errors.
But I will try further.

So why not post your combined code and also the errors (the Copy error messages button will help)? Then we will have something to help you with.


And we trust you read the instructions for posting before posting code, and use the "code" tags also for error messages and serial monitor output.