Created
November 9, 2010 21:39
-
-
Save brian-lc/669865 to your computer and use it in GitHub Desktop.
This is a simple Processing script to drive a Nema motor through the Easystepper driver and an Arduino
This file contains hidden or 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
| /******************************************************** | |
| ** More info about the project at: ** | |
| ** http://lusorobotica.com/viewtopic.php?t=103&f=106 ** | |
| ** by TigPT at [url=http://www.LusoRobotica.com]www.LusoRobotica.com[/url] ** | |
| *********************************************************/ | |
| int dirPin = 2; | |
| int stepperPin = 3; | |
| void setup() { | |
| pinMode(dirPin, OUTPUT); | |
| pinMode(stepperPin, OUTPUT); | |
| } | |
| void step(boolean dir,int steps, int stp_int){ | |
| digitalWrite(dirPin,dir); | |
| delay(50); | |
| for(int i=0;i<steps;i++){ | |
| digitalWrite(stepperPin, HIGH); | |
| delayMicroseconds(stp_int); | |
| digitalWrite(stepperPin, LOW); | |
| delayMicroseconds(stp_int); | |
| } | |
| } | |
| void loop(){ | |
| step(true,160,100); | |
| step(false,160,100); | |
| int s =10; | |
| for(int i=0;i< 10;i++){ | |
| step(true,1600,s); | |
| s = s * 2; | |
| } | |
| step(true,1600,100); | |
| delay(500); | |
| step(false,1600*5,100); | |
| delay(500); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment