|
Steppers not stepping correctly - Mega and Pololu June 22, 2010 01:25PM |
Registered: 15 years ago Posts: 58 |
|
Re: Steppers not stepping correctly - Mega and Pololu June 22, 2010 02:51PM |
Admin Registered: 19 years ago Posts: 7,883 |
|
Re: Steppers not stepping correctly - Mega and Pololu June 22, 2010 04:58PM |
Registered: 15 years ago Posts: 58 |
|
Re: Steppers not stepping correctly - Mega and Pololu June 22, 2010 06:28PM |
Registered: 15 years ago Posts: 58 |
/*
PololuTestMega
Runs 3 Pololu stepper boards by controlling the Direction, Enable and Step pins
Arduino Mega RepStrap Electronics
Created 16 June 2010
By Al Adrian
*/
const int Enablex = 24; // Enable pin x as per Hydra Firmware
const int Directionx = 28; // Direction pin x
const int Stepx = 26; // Step pin x
const int Enabley = 30; // Enable pin y
const int Directiony = 34; // Direction pin y
const int Stepy = 32; // Step pin y
const int Enablez = 36; // Enable pin z
const int Directionz = 40; // Direction pin z
const int Stepz = 38; // Step pin z
int Delay;
int Cnt;
int Circle;
// The setup() method runs once, when the sketch starts
void setup() {
// initialize the digital pins as output:
pinMode(Enablex, OUTPUT);
pinMode(Directionx, OUTPUT);
pinMode(Stepx, OUTPUT);
pinMode(Enabley, OUTPUT);
pinMode(Directiony, OUTPUT);
pinMode(Stepy, OUTPUT);
pinMode(Enablez, OUTPUT);
pinMode(Directionz, OUTPUT);
pinMode(Stepz, OUTPUT);
digitalWrite (Directionx, LOW); //LOW Clockwise, HIGH Counter Clockwise
digitalWrite (Directiony, LOW); //LOW Clockwise, HIGH Counter Clockwise
digitalWrite (Directionz, LOW); //LOW Clockwise, HIGH Counter Clockwise
digitalWrite (Enablex, LOW); //LOW is Pololu enabled
digitalWrite (Enabley, LOW); //LOW is Pololu enabled
digitalWrite (Enablez, LOW); //LOW is Pololu enabled
Delay = 1000; //microseconds
Circle = 9999; //400 steps around on the little motor, *16 for the 1/16 mode minus1
}
// the loop() method runs over and over again,
// as long as the Arduino has power
void loop()
{
digitalWrite(Stepx, HIGH); // set the Step on
digitalWrite(Stepy, HIGH); // set the Step on
digitalWrite(Stepz, HIGH); // set the Step on
delayMicroseconds(Delay); // wait for a tenth second
digitalWrite(Stepx, LOW); // set the Step off
digitalWrite(Stepy, LOW); // set the Step off
digitalWrite(Stepz, LOW); // set the Step on
delayMicroseconds(Delay); // wait for a tenth second
}
|
Re: Steppers not stepping correctly - Mega and Pololu June 26, 2010 09:48PM |
Registered: 15 years ago Posts: 58 |
|
Re: Steppers not stepping correctly - Mega and Pololu June 27, 2010 06:47PM |
Registered: 15 years ago Posts: 58 |
/*
PololuTestMega
Runs 3 Pololu stepper boards by controlling the Direction, Enable and Step pins
Arduino Mega RepStrap Electronics
Created 16 June 2010
By Al Adrian
*/
const int Enablex = 24; // Enable pin x as per Hydra Firmware
const int Directionx = 28; // Direction pin x
const int Stepx = 26; // Step pin x
const int Enabley = 30; // Enable pin y
const int Directiony = 34; // Direction pin y
const int Stepy = 32; // Step pin y
const int Enablez = 36; // Enable pin z
const int Directionz = 40; // Direction pin z
const int Stepz = 38; // Step pin z
int i;
int Delay;
int Cnt;
int Circle;
// The setup() method runs once, when the sketch starts
void setup() {
// initialize the digital pins as output:
pinMode(Enablex, OUTPUT);
pinMode(Directionx, OUTPUT);
pinMode(Stepx, OUTPUT);
pinMode(Enabley, OUTPUT);
pinMode(Directiony, OUTPUT);
pinMode(Stepy, OUTPUT);
pinMode(Enablez, OUTPUT);
pinMode(Directionz, OUTPUT);
pinMode(Stepz, OUTPUT);
digitalWrite (Directionx, LOW); //LOW Clockwise, HIGH Counter Clockwise
digitalWrite (Directiony, LOW); //LOW Clockwise, HIGH Counter Clockwise
digitalWrite (Directionz, LOW); //LOW Clockwise, HIGH Counter Clockwise
digitalWrite (Enablex, LOW); //LOW is Pololu enabled
digitalWrite (Enabley, LOW); //LOW is Pololu enabled
digitalWrite (Enablez, LOW); //LOW is Pololu enabled
Delay = 60; //microseconds
Circle = 9999; //400 steps around on the little motor, *16 for the 1/16 mode minus1
}
// the loop() method runs over and over again,
// as long as the Arduino has power
void loop()
{
digitalWrite(Directionx, LOW); // set the Direction low
digitalWrite(Directiony, LOW); // set the Direction HIGH
digitalWrite(Directionz, LOW); // set the Direction HIGH
for (int i = 0; i < 100; i++){
digitalWrite(Stepx, HIGH); // set the Step on
digitalWrite(Stepy, HIGH); // set the Step on
digitalWrite(Stepz, HIGH); // set the Step on
delayMicroseconds(Delay); // wait for a tenth second
digitalWrite(Stepx, LOW); // set the Step off
digitalWrite(Stepy, LOW); // set the Step off
digitalWrite(Stepz, LOW); // set the Step on
delayMicroseconds(Delay); // wait for a tenth second
delay(20);
}
digitalWrite(Directionx, HIGH); // set the Direction HIGH
digitalWrite(Directiony, HIGH); // set the Direction HIGH
digitalWrite(Directionz, HIGH); // set the Direction HIGH
for (int i = 0; i < 100; i++){
digitalWrite(Stepx, HIGH); // set the Step on
digitalWrite(Stepy, HIGH); // set the Step on
digitalWrite(Stepz, HIGH); // set the Step on
delayMicroseconds(Delay); // wait for a tenth second
digitalWrite(Stepx, LOW); // set the Step off
digitalWrite(Stepy, LOW); // set the Step off
digitalWrite(Stepz, LOW); // set the Step on
delayMicroseconds(Delay); // wait for a tenth second
delay(20);
}
}
|
Re: Steppers not stepping correctly - Mega and Pololu December 18, 2011 10:05AM |