Help with certain parts of the meArm Code (for Joystick Control)

gfvalvo:
For improved readability, I'd change this:

    if (value[i] > 612) {

idle = 0;
     if (currentAngle[i] > MIN[i]) --currentAngle[i];
   } else if (value[i] < 412) {
     idle = 0;
     if (currentAngle[i] < MAX[i]) ++currentAngle[i];
   } else {
     ++idle;
   }




To this:


if (value[i] > 612) {
     idle = 0;
     if (currentAngle[i] > MIN[i]) {
       currentAngle[i]--;
     }
   } else if (value[i] < 412) {
     idle = 0;
     if (currentAngle[i] < MAX[i]) {
       currentAngle[i]++;
     }
   } else {
     idle++;
   }




The code blocks defined by the extra { / } pairs make the conditional flow more clear.

and I in turn would change it to

if (value[i] > 612)
{
  idle = 0;
  if (currentAngle[i] > MIN[i])
  {
    currentAngle[i]--;
  }
}
else if (value[i] < 412)
{
  idle = 0;
  if (currentAngle[i] < MAX[i])
  {
    currentAngle[i]++;
  }
}
else
{
  idle++;
}

to make the code blocks even more obvious.

I would also replace the magic numbers with suitably named constants to make the code even more readable.