Moderator: RevPiModIO

 
mtgstuber
Topic Author
Posts: 2
Joined: 18 Jan 2023, 20:51
Answers: 0

Negative Values

08 Feb 2023, 06:11

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?
 
User avatar
RevPiModIO
KUNBUS
Posts: 303
Joined: 20 Jan 2017, 08:44
Answers: 0
Contact:

Re: Negative Values

08 Feb 2023, 06:54

Hi!

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

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
python3-RevPiModIO - https://revpimodio.org/ || Der RevPi ist das Beste, was passieren konnte!
 
mtgstuber
Topic Author
Posts: 2
Joined: 18 Jan 2023, 20:51
Answers: 0

Re: Negative Values

08 Feb 2023, 17:09

Thank you!

Who is online

Users browsing this forum: No registered users and 1 guest