0% found this document useful (0 votes)
30 views1 page

Omg

The document defines pins for controlling a stepper motor and includes setup and loop functions to sequentially activate the pins to rotate the motor in steps, checking an input pin to control rotation.

Uploaded by

Nikhilan V
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views1 page

Omg

The document defines pins for controlling a stepper motor and includes setup and loop functions to sequentially activate the pins to rotate the motor in steps, checking an input pin to control rotation.

Uploaded by

Nikhilan V
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#define STEPPER_PIN_1 2//9

#define STEPPER_PIN_2 3//10


#define STEPPER_PIN_3 4//11
#define STEPPER_PIN_4 5//12
void setup() {
if(digitalRead(12)==LOW){

for(int i=0; i<=50; i++){


}
}

// put your setup code here, to run once:


pinMode(STEPPER_PIN_1, OUTPUT);
pinMode(STEPPER_PIN_2, OUTPUT);
pinMode(STEPPER_PIN_3, OUTPUT);
pinMode(STEPPER_PIN_4, OUTPUT);
pinMode(12,INPUT_PULLUP);
}

void loop() {
// put your main code here, to run repeatedly:
digitalWrite(STEPPER_PIN_1, HIGH);
digitalWrite(STEPPER_PIN_2, LOW);
digitalWrite(STEPPER_PIN_3, LOW);
digitalWrite(STEPPER_PIN_4, LOW);
delay(100);

digitalWrite(STEPPER_PIN_1, LOW);
digitalWrite(STEPPER_PIN_2, HIGH);
digitalWrite(STEPPER_PIN_3, LOW);
digitalWrite(STEPPER_PIN_4, LOW);
delay(100);

digitalWrite(STEPPER_PIN_1, LOW);
digitalWrite(STEPPER_PIN_2, LOW);
digitalWrite(STEPPER_PIN_3, HIGH);
digitalWrite(STEPPER_PIN_4, LOW);
delay(100);

digitalWrite(STEPPER_PIN_1, LOW);
digitalWrite(STEPPER_PIN_2, LOW);
digitalWrite(STEPPER_PIN_3, LOW);
digitalWrite(STEPPER_PIN_4,HIGH);
delay(100);
}

You might also like