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

Arduino Stepper Motor Control Code

Uploaded by

bm6320100
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)
2 views1 page

Arduino Stepper Motor Control Code

Uploaded by

bm6320100
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

const int dirPin = 2;

const int stepPin = 3;

const int boton1 = 8;


const int boton2 = 9;
void setup() {
pinMode(dirPin, OUTPUT);
pinMode(stepPin, OUTPUT);
pinMode(boton1,INPUT_PULLUP);
pinMode(boton2,INPUT_PULLUP);
}

void loop() {

if(digitalRead(boton1)==LOW){
digitalWrite(dirPin, HIGH);

digitalWrite(stepPin, HIGH);
delayMicroseconds(1500);

digitalWrite(stepPin, LOW);
delayMicroseconds(1500);
}

if(digitalRead(boton2)==LOW){

digitalWrite(dirPin, LOW);

digitalWrite(stepPin, HIGH);
delayMicroseconds(1500);

digitalWrite(stepPin, LOW);
delayMicroseconds(1500);

You might also like