overflow Ard Uno

Hi guys,
I kind of new here and quite green behind my ears with programming.

I am doing a little upgrade on my lathe by making a deviding head using stepper control based on an Uno.

as I am not a programmer I went looking around an found a pretty straight forward sketch. see attachement.

the first files i found was all with "int" that did not allow me to use decimal ratio for my gearing of 5.625.
after searching some more I found one with "floats" that was working ok at some point. It allowed me to do the ratio of 5.625.

however as I want to upscale the number of steps to 25600*5.625=144000 steps for having less round off loss of division accuracy.

currently I am running at 72000 and it seems to work. after I changes all the ints to floats.

but 144000 is not working than the motor keeps spinning endlesly...

anyone any clue?

thx

float_stepper_divider_float_72K.ino (7.28 KB)

Do some debugging using serial. Print what is being passed to the rotation function just before the for loop there.

Also, you should be able to use unsigned long rather than float. Deal with the decimal issue by calculating the Multiplier manually if you have to.

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom.... :slight_smile:

whoops my bad :slight_smile:

thx for the welcome on this forum