stepper motor programme

Sander 16

hello, i have been working on a machine for a while now, i have 3d printed out the parts i need, and now need to write the programme for the motor, its for a standard 5v stepper motor. i need the motor to rotate clockwise for a minute, and then anti clockwise for a minute. and then stop for mabye an hour.

i know i can use the "delay" command to make the motor stand still. but it still draws power and heats up, which would be a problem, because it cant get to hot in the machine.

i read that i could write:

digitalWrite(8,LOW);
** digitalWrite(9,LOW);**
** digitalWrite(10,LOW);**
** digitalWrite(11,LOW);**

to shut off the motor, which workes, but then thats it it just stays turned off it doesnt repeat the cycle of turning clockwise - anti clockwise - off for an hour - turning clockwise - anti clockwise - off for an hour...

ive never written any code before, so i dont know how to make it only turn off for a defined ammount of time. if anybody knows how to do this, could you help me out?

heres the code ive got so far:

#include <Stepper.h>
#define STEPS 2038
Stepper stepper(STEPS, 8, 10, 9, 11);
void setup()
{ **
** stepper.setSpeed(6);

** stepper.step(12228);**
** delay(0);**
** stepper.setSpeed(6);**
** stepper.step(-12228);**

** digitalWrite(8,LOW);**
** digitalWrite(9,LOW);**
** digitalWrite(10,LOW);**
** digitalWrite(11,LOW); **
}
void loop()
{}

The simplest way would be to move the code from setup() to loop() and add a
delay(1000UL * 60 * 60);  //wait for 1 hour
after digitalWrite(11, LOW);.

Of course nothing can happen during the delay. Better would be to use millis() for the timing so the program can do other stuff during the wait, if necessary.
Non-blocking timing tutorials:
Several things at a time.
Beginner's guide to millis().
Blink without delay().

  delay(0);

Read the how to use this forum-please read sticky to see how to properly post code. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code.
Is just silly (useless ).

if your steppermotor gets really hot the current is to high for this steppermotor.
The current must be adjusted to a value which makes the stepper-motor's temperatur rise to maybe 35 °C.

Depending on the stepper-driver you are using there is an ability to switch off the current through the motor-coils with an enable-input.

So next thing is to write about the exact type of stepper-motor and steppermotor-driver you are using. A link to the website where you bought the steppermotor and the steppermotordriver.

Working with arduino and electronics is not superstandardised like installing an app on a smartphone or pluggin in any kind of USB-device into a computer

Working with arduino and electronics requieres a minimum of knowledge how to make it work.
Which means knowledge about programming and knowledge about electronics.

It is really OK that you are asking. But you have to provide a minimum of concrete details about the hardware that you are using to get suggestions that have a high chance to make your project work.

best regards Stefan

the solution was simple

#include <Stepper.h>
#define STEPS 2038

Stepper stepper(STEPS, 8, 10, 9, 11);

void setup() 
{}
void loop() 
{ 
 stepper.setSpeed(6);
 stepper.step(-1000UL * 60 * 1);
 delay(0);
 stepper.setSpeed(6);
 stepper.step(1000UL * 60 * 1);
 
 digitalWrite(8,LOW);
 digitalWrite(9,LOW);
 digitalWrite(10,LOW);
 digitalWrite(11,LOW);
 delay(1000UL * 60 * 60); 
}