So far my Arduino is quite able to make the motor run by sending step and direction signals to the Leadshine motor controller.
However now I somehow got the idea that my arduino should do a bit more than just send spikes to the controller and attached two 0,96" I²C OLED displays.
However when the motor is spinning any attempt to update the display results in a short pause. The motor just stops. I suppose display activities take too long so that some spikes are missing?
Is there any way around this?
Do I have to use more than one Arduino to split the activities? One doing GUI and the other one handles the steps?
Any help would be great.
That's my main routine (and of course there are no delays in the code..)
void loop() {
if (millis()-tlastRefresh > tDisplayRefresh) updateDisplays(stepper.currentPosition(), stepper.speed());
if (stepper.distanceToGo() == 0)
stepper.moveTo(-stepper.currentPosition());
stepper.run();
}
Things I have tried:
display refresh time variations: usually set to 100ms (but generally this makes no difference - I can just vary the pauses,
remove the displays because the'yre powered through the arduino board - but this doesn't make a difference at all.
I think physikcally removing the display does have an effect.. unfortunately I can't really measure what's going on. Guess I will need to invest in a scope?
I don't see anything around that. How can the Leadshine see if I've got a display attached..
Anyway - that's the best datasheet like document, I think. It's at least using western letters..
They claim to use servo like technology to really control the position.. This thing hasn't been terribly expensive and people used it successfully.
Problem is I plan to use a lot more on the arduino. If troubles now already start I will probably use two arduinos - one for simply taking care of ONLY creating steps and the other one for GUI and all that stuff - would make some sense?
I've tried to shorten everything already. Will just for fun test your very short version..
Ok - now the ramps sound (?) funny with the stepper motor.
I really think it's timing trouble senying anything on I2C. Don't know why.