motorised lamp with Nema 14 and DRV8820

Hello community,
this is about my study-semesterprojekt. I am new in working with arduino... But tried some things so far.
I started with an 28BYJ-48 Stepper motor but the power was not enough to get the lamp automaticially open.
The board I use is the Arduino Mega 2560.

I started watching tutorials about the Nema and tried to write the code to it, but it didn´t started to work.
Now the time to finish the project is short and my knowledge too, so I need help. So please if you have something in mind that could help, please share with me. Thanks a lot. :wink:

Here is my last code... and my thinkercad grafic

// Define stepper motor connections and steps per revolution:
#define dirPin 2
#define stepPin 3
#define stepsPerRevolution 200

void setup() {
// Declare pins as output:
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
}

void loop() {
// Set the spinning direction clockwise:
digitalWrite(dirPin, HIGH);

// Spin the stepper motor 1 revolution slowly:
for (int i = 0; i < stepsPerRevolution; i++) {
// These four lines result in 1 step:
digitalWrite(stepPin, HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin, LOW);
delayMicroseconds(2000);
}

delay(1000);

// Set the spinning direction counterclockwise:
digitalWrite(dirPin, LOW);

// Spin the stepper motor 1 revolution quickly:
for (int i = 0; i < stepsPerRevolution; i++) {
// These four lines result in 1 step:
digitalWrite(stepPin, HIGH);
delayMicroseconds(1000);
digitalWrite(stepPin, LOW);
delayMicroseconds(1000);
}

delay(1000);

// Set the spinning direction clockwise:
digitalWrite(dirPin, HIGH);

// Spin the stepper motor 5 revolutions fast:
for (int i = 0; i < 5 * stepsPerRevolution; i++) {
// These four lines result in 1 step:
digitalWrite(stepPin, HIGH);
delayMicroseconds(500);
digitalWrite(stepPin, LOW);
delayMicroseconds(500);
}

delay(1000);

// Set the spinning direction counterclockwise:
digitalWrite(dirPin, LOW);

//Spin the stepper motor 5 revolutions fast:
for (int i = 0; i < 5 * stepsPerRevolution; i++) {
// These four lines result in 1 step:
digitalWrite(stepPin, HIGH);
delayMicroseconds(500);
digitalWrite(stepPin, LOW);
delayMicroseconds(500);
}

delay(1000);
}

julia_asks:
So please if you have something in mind that could help, please share with me. Thanks a lot. :wink:

You have not told us what problem you need help with. What does your program actually do and what do you want it to do that is different.

Are you sure you don't have a DRV8825 stepper driver - when I Google for DRV8820 I don't get anything.

Please post a link to the datasheet for your stepper motor.

These links may help.
Stepper Motor Basics
Simple Stepper Code

Always start testing a stepper motor at a very low speed - for example 5 steps per second.

...R

PS ... When posting code please use the code button </>

so your code 
looks like this

See How to get the best out of the Forum