Hello,
I am a newbie and have made a hanging rotation gadget with Nema17, an Arduino uno and an easy driver 4988 for photographing jewelry products such as a necklace with pendant. I have never written code before, however just wrote one after reading and experimenting.
The issue -
- The rotation needs to be very slow, so the hanging necklace does not swing too much between wait states
The motor needs to stop every 10 degrees moving clockwise (more or less depending the number of photographs needed each 360 degree turn)
The motor does it with the current code below, but I have an issue with jerks at start and stop between each step.
I will appreciate some help as I don't seem to be getting anywhere.
Thanks in advance!
Burt
here's the code -
// 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,LOW); // Enables the motor to move in a particular direction
// Makes pulses for making one full cycle rotation
for(int x = 0; x < 6; x++)
{
analogWrite(stepPin,HIGH);
delayMicroseconds(500);
digitalWrite(stepPin,LOW);
delayMicroseconds(500);
}
delay(5000); // five second delay
}