I need help to Reduce Arduino Sketch

I have this Arduino code I found in a tutorial which moves the servo motor when I power on the Arduino and whenever I press the button. How can I reduce the code to eliminate the button part and just execute the motor command once when I plug the Arduino in?

I’m a very beginer so I don’t know anything about writing or reading code, I jut copy-pasted that code from a tutorial.
Thank you!

 Controlling a servo with Push button with Arduino
 this is code #1 to control servo with push button by Robojax (Robojax.com )

code #1 when push button the servo goes from 0° to 180° (or set your angle) and returns back
    Watch video for code #1: https://youtu.be/fPrPRZlGdvA

#include <Servo.h>

Servo myservo;  // create servo object to control a servo
#define servoPin 3 //~
#define pushButtonPin 2 

int angle =45;    // initial angle  for servo (beteen 1 and 179)
int angleStep =10;
const int minAngle = 45;
const int maxAngle = 50;

const int type =2;//watch video for details. Link is at the top of this code (robojax)

int buttonPushed =1;

void setup() {
  // Servo button demo by Robojax.com
  Serial.begin(9600);          //  setup serial
  myservo.attach(servoPin);  // attaches the servo on pin 3 to the servo object
   Serial.println("Robojax Servo Button ");
   myservo.write(angle);//initial position

void loop() {
  if(digitalRead(pushButtonPin) == LOW){
    buttonPushed = 1;
   if( buttonPushed ){
  // change the angle for next time through the loop:
  angle = angle + angleStep;

    // reverse the direction of the moving at the ends of the angle:
    if (angle >= maxAngle) {
      angleStep = -angleStep;
        if(type ==1)
            buttonPushed =0;                   
    if (angle <= minAngle) {
      angleStep = -angleStep;
       if(type ==2)
            buttonPushed =0;       
    myservo.write(angle); // move the servo to desired angle
      Serial.print("Moved to: ");
      Serial.print(angle);   // print the angle
      Serial.println(" degree");    
  delay(200); // waits for the servo to get there


2 posts were merged into an existing topic: May Arduino execute sketch on power supply?