Page 1 of 1

Negative Values

Posted: 08 Feb 2023, 06:11
by mtgstuber
I'm using an encoder with a RevPiCore, a RevPiDIO, and RevPiModIO. It appears that ct.io.MyEncoder.value returns an unsigned 32 bit, such that when I turn the encoder past zero, instead of getting -1, I get 4294967295. Is there a signed version of .value, or do I need to do my own conversion?

Re: Negative Values

Posted: 08 Feb 2023, 06:54
by RevPiModIO
Hi!

You can configure the IO in your Python program. Just set the signed value of your input to True.

Code: Select all


your_revpi_mod_io.io.your_input.signed = True

# Now the value will show negative values
print(your_revpi_mod_io.io.your_input.value)

Sven

Re: Negative Values

Posted: 08 Feb 2023, 17:09
by mtgstuber
Thank you!