When trying to read the digital inputs all at once on the Portenta Machine Control, the resulting bit order seems to be out of sequence in the output variable. I may have traced it down to this enum in ArduinoIOExpander.h:
I would expect that the physical pins on the board would match the bit sequence in the output of readAll(). However the sequence on the board from LSB to MSB is:
This seems to match the pattern in the enum above.
Is it possible to return the readAll() in a sequence that matches the board layout?
Use case: I'm trying to input an 8-bit pattern to the DIs which I can translate to an integer and then use an index to an array. I'm a novice at all of this, so apologies if I'm just missing something simple.
When trying to read the digital inputs all at once on the Portenta Machine Control, the resulting bit order seems to be out of sequence in the output variable. I may have traced it down to this enum in
ArduinoIOExpander.h
:https://github.com/arduino-libraries/Arduino_MachineControl/blob/ca7ff9b35c6837733d398649fd4db86f10d5b252/src/utility/ioexpander/ArduinoIOExpander.h#L74-L83
I would expect that the physical pins on the board would match the bit sequence in the output of
readAll()
. However the sequence on the board from LSB to MSB is:DIN_READ_CH_PIN_05
,DIN_READ_CH_PIN_04
,DIN_READ_CH_PIN_03
,DIN_READ_CH_PIN_02
,DIN_READ_CH_PIN_01
,DIN_READ_CH_PIN_07
,DIN_READ_CH_PIN_06
,DIN_READ_CH_PIN_00
This seems to match the pattern in the enum above.
Is it possible to return the
readAll()
in a sequence that matches the board layout?Use case: I'm trying to input an 8-bit pattern to the DIs which I can translate to an integer and then use an index to an array. I'm a novice at all of this, so apologies if I'm just missing something simple.