Two Stepper Motors, One Push button, and One LCD screen

Hello all,

Being new to the world of coding, I need some help determining how (or if) I can use one push button to control the actions of two motors simultaneously (i.e. one button push would start both motors and a second button push would stop both motors).

Futhermore, I would like to connect an LCD screen that shows the number of seconds that have passed as the motors are running.

The materials I have are as follows:

  1. Two bipolar stepper motors (step angle 1.8 degrees)
  2. One Adafruit V2 motor shield.
  3. One Arduino Uno
  4. One LCD screen

I run the motors at the same time by formatting the loop so that motor one takes a step, then motor two takes a step and the cycle repeats itself.

Am I able to make the device do what I need it to do with what I have, or do I need to get something else in order to make it function properly?

Thank you,
Pleurodelinae

You have not listed a pushbutton, and you have not discussed power supplies. The power for the motors should NOT come from the Arduino.

With the addition of a pushbutton and some wiring and some coding, you have what you need for this project.

However, some people have problems at this point. I suggest that you learn how to debounce a switch (your pushbutton), learn about the millis() function, do NOT use the delay(...) function, and post a new thread if/when you want help.

Why a new thread? This one would be good enough...

Agree with the rest of the advice, no problem doing what is expected given the right wiring, power supply and code

The push button is a "Rugged LCD Push Button", and it has a standard make up with a prong for normally open, normally closed, and so on. As for the power supply, I run the two motors with a 12 v adapter that plugs directly into the wall. Would an additional power source be necessary? I was hoping to just attach the push button directly to the prototype area of the motor shield.

At any rate, what would a simple sample code look like?

I will defiantly looking denouncing the push button as well as the mills() function, so thank you for the advice.

Best,
Pleurodelinae

Pleurodelinae wrote (in part):

The push button is a "Rugged LCD Push Button", and it has a standard make up with a prong for normally open, normally closed, and so on.

I am uncertain that there is a standard make up, but if you can wire the common terminal of the switch to ground, and the normally closed contact on the switch to a pin on the Arduino, and set the mode of this pin to INPUT_PULLUP, then when you do a digitalRead(...) on the pin, a result of LOW will mean that the button is not being pushed, and a result of HIGH will mean that the button is being pushed (aside from any bouncing, of course).

Pleurodelinae wrote (in part):

Would an additional power source be necessary?

Who knows? There is nothing in the description about wattage of the power supply, or current (input or output), and nothing that tells me that the Arduino does not also use the supply.

Pleurodelinae wrote (in part):

At any rate, what would a simple sample code look like?

I will not provide sample code, although others might. The Arduino is all about writing your own code. This forum is all about you presenting your own code and us providing help with it. If I provide code, I stop the learning process. Sorry.

Pleurodelinae wrote (in part):

I will defiantly looking denouncing the push button as well as the mills() function, so thank you for the advice.

I interpret this as "I will definitely be looking at debouncing the push button, as well as I will be looking at the millis() function..."

You are welcome. Good Luck!

These links may help
Stepper Motor Basics

Simple Stepper Code
especially the second example that uses millis() and micros() rather than delay()

also look up the AccelStepper library

And the demo Several Things at a Time illustrates the use of millis() to manage timing without blocking.

...R