All the parts for the stepper assembly arrived.
1 hour: Setup and soldering
30 minutes: Connecting the parts and running a simple test script
//Test script
// 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
// 200 pulses = full rotation
for(int x = 0; x < 200; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(1000);
digitalWrite(stepPin,LOW);
delayMicroseconds(1000);
}
delay(1000);
digitalWrite(dirPin,LOW); //Changes the rotations direction
// 400 pulses == 2 rotations
for(int x = 0; x < 400; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(1000);
digitalWrite(stepPin,LOW);
delayMicroseconds(1000);
}
delay(1000);
}
The correct color order left to right with the pot on the left side is: Red-Green-
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.