You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The way it is now: val values = (data[1].toInt() ushr 7) or data[2].toInt()
Throws away all the data bits in the first digital message data byte
It should be val values = data[1].toInt() or (data[2].toInt() shl 7)
Which keeps the 7 bits, and then the LSB of data[2] becomes the MSB of the result
Also: val port = data[0].toInt() and 0x7F
Will result in the port value being 16 higher than what is should be. Since the port number is just the second nibble of the 0x9_ command, the correct way is val port = data[0].toInt() and 0x0F
Otherwise the port number and pin states can't be obtained from the data sent by the board.
The text was updated successfully, but these errors were encountered:
The way it is now:
val values = (data[1].toInt() ushr 7) or data[2].toInt()
Throws away all the data bits in the first digital message data byte
It should be
val values = data[1].toInt() or (data[2].toInt() shl 7)
Which keeps the 7 bits, and then the LSB of data[2] becomes the MSB of the result
Also:
val port = data[0].toInt() and 0x7F
Will result in the port value being 16 higher than what is should be. Since the port number is just the second nibble of the 0x9_ command, the correct way is
val port = data[0].toInt() and 0x0F
Otherwise the port number and pin states can't be obtained from the data sent by the board.
The text was updated successfully, but these errors were encountered: