Wildbill,
I changed to volatile unsigned long encoderPos now.
originally this was a volatile unsigned int encoderPos
When I changed to long I accendentlly removed the volatile int.
Anyway after changing to "volatile unsinged long encoderPos" same problem.
Reading the encoder values is not the problem as the serialmonitor nicely shows these values when the motor steps.
It is the line
if (encoderPos >= (encoderPosOld + 1070)) //if the value is 1070 higher then last known raise stepcounter by 1
{
StepCounter = StepCounter + 1;
}
that does not in or decrement although the encoder values.
Paco