arrayssensors

How do I interpret this data return from a robot?


I'm trying to read a wall sensor on a robot. The description is:

The strength of the wall sensor’s signal is returned as an unsigned 16-bit value, high byte first.

Range: 0-4095

Any clues on how to interpret this? The data comes back to me in a byte array of size 2.


Solution

  • I'd interpret that to mean:

    Range of values:

    0000 0000 0000 0000 to 0000 1111 1111 1111 1111

    Given the return type, you'll get:

    ARR[0] 0000 0000, ARR[1] 0000 0000 to ARR[0] 0000 1111, ARR[1] 1111, 1111

    0 possibly means out of range, 4095 possibly means impact? Suck it and see!