Servo Max Min values sometimes return as 65535

Forums:

Hi,

Sometimes I read a maximum or minimum value and the value is 65535 (-1 ?) . I read it again and then it gives the correct value .

piborg's picture

Is this using the GetServoMinimumX and GetServoMaximumX functions from the UltraBorg.py library?

No I am using windows IOT and C# . Here is the method I am using. Sometimes it works correctly other times it returns the same value for Max, MIN and Start, it usually is the Start value which is returned 3 times. It does not happen all the time thought . The 65535 value seems to be returned randomly . When I compile my code in debug mode it works correctly , however when I compile it in release mode the start value is returned for start,min and max. Could it be a timing issue ? Or maybe because I am using the Lightning driver for IOT rather than the inbox driver ? Here is the code I use to read the value

        private int GetIntegerValue(byte commandValue)
        {
            byte[] recvBytes = new byte[I2C_MAX_LEN];
            byte[] sendBytes = new byte[] { commandValue };

            ubI2C.Write(sendBytes);
            ubI2C.Read(recvBytes);

            int minVal = ((int)recvBytes[1] << 8) + (int)recvBytes[2];
            return minVal;
        }

Hi,

Please ignore above issues. I have switched to using the inbox controller driver on IOT rather than the lightning memory mapped driver and the problems are resolved. Apologies for raising non existent issue.

piborg's picture

That is good news, these problems can be difficult to find :)

Thanks for letting us know what the solution is. I will make a note of this in case anyone else asks about using our boards with Windows IoT.

Subscribe to Comments for &quot;Servo Max Min values sometimes return as 65535&quot;