Skip to content

Instantly share code, notes, and snippets.

@samirsogay
Created August 23, 2019 15:57
Show Gist options
  • Save samirsogay/1ea6efbb33ff64e55ed04c8b595d3822 to your computer and use it in GitHub Desktop.
Save samirsogay/1ea6efbb33ff64e55ed04c8b595d3822 to your computer and use it in GitHub Desktop.
// defines pins numbers
const int stepPin = 3;
const int dirPin = 4;
void setup() {
// Sets the two pins as Outputs
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
}
void loop() {
digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction
digitalWrite(stepPin,HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin,LOW);
delayMicroseconds(2000);
}
@ManuelFreitas
Copy link

I WANT TO REVERSE

@samirsogay
Copy link
Author

You can set the dirPin as LOW

@watersoup
Copy link

Hi Samir, Nice video,
Was wondering if you have diagram for the connections please.
Thanks,
Jag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment