Arduino sleep at 2 times and control stepper motor

Hi,

I want to run a stepper motor at 2 times (eg at 20:00 stepper motor direction 1 and at 06:00 direction -1).

Does anyone have an idea how this is possible?

Friendly regards

Use an RTC (Real Time Clock)

Do you know how to control the stepper ?

What code have you written so far ?

Sorry, but I missed the reference to sleep in the topic title

What exactly do you mean by sleep in this context ?

So I am making a shutter that closes at night and opens in the morning. The rest of the day I would like to let my arduino go uno is sleep mode so that it has less energy consumption.

At the moment I can’t let it go up and down by means of a button. When I press the button the hatch goes up and when I press again the direction changes and it goes down.

//include Arduino stappen motor library
#include <Stepper.h>
 
//aantal stappen van de motor
#define STEPS 32
 
Stepper stepper(STEPS, 8, 10, 9, 11); //stappen motor Arduino pinnen 8,9,10,11


const int knop =  2; //knop op Arduino pin 4
int richting = 1; //de richting variable

//de void setup
void setup()
{
  //knop instellen als input met interne pull up
  pinMode(knop, INPUT_PULLUP);
}

// void loop
void loop()
{
  if ( digitalRead(knop) == 0 )  //als knop is ingedrukt
    if ( debounce() )  //debounce knop sigaal
    {
      richting *= -1;  //omkeren van de richting variable
      while ( debounce() ) ;  //wacht tot knop is los gelaten
    }
 
  //Sneleid motor instellen
  stepper.setSpeed(500);
  //stappen moter in beweging brengen
  stepper.step(richting);
 
}
 
//functie voor de knop debounce
bool debounce()
{
  byte teller = 0;
  for(byte i = 0; i < 5; i++) {
    if (digitalRead(knop) == 0)
      teller++;
    delay(10);
  }
  if(teller > 2)  return 1;
  else           return 0;
}