Created
May 11, 2017 10:37
-
-
Save e-Gizmo/e39db23548e516e72376a6b5e82723e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
e-Gizmo Microstep Driver Sample code | |
*""""Wiring connections:"""* | |
Gizduino MCU to Microstep | |
D3 -------------> DIR | |
D4 -------------> STP/CLK | |
GND -------------> GND | |
+5V -------------> VIN | |
by e-Gizmo Mechatronix Central | |
http://www.e-gizmo.com | |
February 18, 2016 | |
*/ | |
//Pin assignments | |
int STP = 4; | |
int DIR = 3; | |
int delay_ms = 1000; | |
int delay_time = 10; | |
void setup() { | |
//make the pins as an output | |
pinMode(STP,OUTPUT); | |
pinMode(DIR,OUTPUT); | |
} | |
void loop() { | |
// digitalWrite(DIR,HIGH); // The motor moves in a particular direction | |
// makes 100000 pulses | |
for(int x = 0; x < 10000; x++) { | |
digitalWrite(STP,HIGH); | |
delayMicroseconds(delay_ms); | |
digitalWrite(STP,LOW); | |
delayMicroseconds(delay_ms); | |
} | |
delay(delay_time); // One second delay | |
digitalWrite(DIR,LOW); //Changes the direction | |
// makes 10000 pulses | |
for(int x = 0; x < 10000; x++) { | |
digitalWrite(STP,HIGH); | |
delayMicroseconds(delay_ms); | |
digitalWrite(STP,LOW); | |
delayMicroseconds(delay_ms); | |
} | |
delay(delay_time); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment