문제

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.

도움이 되었습니까?

해결책

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!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top