Solved.
Attached, the new version.
Or, if you want to change the code yourself,
Function "void Index(int mod,int..." about line 1165
if(mod<3)
{
newdeg%=360000L; // was 3600000L (too many zeros...)
newpos=lround((float)newdeg/360000.0*(float)stprot);
}
Now, about the digital input pins, on the LCD shield, connector J5, the order of the pins are: D0 D1 D2 D3 D11 D12 D13
I was confused at first too. But checking whit a ohmmeter confirmed what is shown on the pdf diagram provided by SainSmart (LCDKeypad Shield SCH.pdf)
Wagner