Tony Allen Baker
I have setup an "electric miter box" based on your tutorial. Works great. However, if you enter a value that is too high, it will work in reverse instead of moving forward.
I have a screw jack that moves 8mm on a single turn. I modified your formula to 'z * 1600 / 8' to care for this problem... works fantastic and accurate, but again, if you enter a value too high (such as 170 'mm'), instead of running from 0 - 170, it runs from 0 to -170.
I can't find anything in your code that corresponds to this error.
Please point me in the right direction.
Quote 0 0

Hi Tony,

It´s a while ago you posted your question, I just found it, hope you solved the problem...

...if not, here is what I did:

change the


// Variables to hold Distance and CurrentPosition
int keyfullnumber=0;  // used to store the final calculated distance value
String currentposition = "";  // Used for display on Nokia LCD

to the following:


// Variables to hold Distance and CurrentPosition
long keyfullnumber=0;  // used to store the final calculated distance value
String currentposition = "";  // Used for display on Nokia LCD

This should solve the problem, you were reaching numbers in the calculation of the steps being higher than 32,767
With long you will change it to 2,147,483,647


Quote 0 0

Add a Website Forum to your website.