I have a CNC type machine, where I take a Serial bytes and transfer them into the necessary stepper motor steps. The code is pretty huge, so to spare you all the details, the way the code is setup, is to individually read each point like:
if(Serial.available() == 13) //13 points of data A = Serial.read(); B = Serial.read(); C = Serial.read(); //etc
And then basically I calculate: x = (A*10000)+(B*1000)+(C*100)+(D*10)+E
The problem I am seeing is that anything over 33,000 my data becomes incorrect. I have tried setting up my 'x' as shown above as:
unsigned long x = (A*10000)+(B*1000)+(C*100)+(D*10)+E;
as well as:
long x = long(A*10000)+(B*1000)+(C*100)+(D*10)+E;
But it still is having the same issue. I know this is a simple issue and I feel silly bring this here, but I can't seem to figure out what I have missed. I can find the issue, I just need some slight direction. Thanks in advance.