Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Define Arduino pins for STEP and DIRECTION
- const int dirPin = 8;
- const int stepPin = 9;
- //Define delays between commands, you can play with these
- const int delayStepCommandInMicroSeconds = 50; // Time STEP will be HIGH (pulse)
- const int delayBetweenStepInMicroSeconds = 1200; // Time STEP will be LOW
- void setup() {
- pinMode( stepPin, OUTPUT);
- pinMode( dirPin, OUTPUT);
- for( int x = 0; x < 200; x++ ) {
- digitalWrite( stepPin, HIGH );
- delayMicroseconds( delayStepCommandInMicroSeconds );
- digitalWrite( stepPin, LOW );
- delayMicroseconds( delayBetweenStepInMicroSeconds );
- }
- //Wait one second in a standstill and start over from top
- delay(1000);
- }
- void loop() {
- // Enables the motor to move in a particular direction
- // Remove // to change motor direction
- // digitalWrite( dirPin, HIGH );
- // make 200 pulses which correspond to 360
- // degrees (one full rotation) when using
- // 1.8 step degree motor in full-step mode
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement