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
{{ message }}
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.
I'm trying to use the II2CDevice.Read(int length) method to bring back a six-byte array off the bus. The behavior, though, is that it is bringing back six copies of the FIRST byte of the bus. I've tried this many times, many ways, and all I get back is six of the same byte. Note also, this is a purchased I2C device (a Thunderborg) so I am unable to change its behavior. I've seen in a similar bug elsewhere that the solution was to change a connected Arduino's code to work in a specific way. I've also seen that I should be able to access the underlying WiringPi.Read(int fd, int length) type function, but that is beyond my ken at the moment.
I've replicated the functionality of the Python code TB.RawRead as best I can, but there's a missing piece in the C# commands, in that I can't actually get it to respond properly.
Python code in question:
def RawRead(self, command, length, retryCount = 3):
"""
RawRead(command, length, [retryCount])
Reads data back from the ThunderBorg after sending a GET command
Command codes can be found at the top of ThunderBorg.py, length is the number of bytes to read back
The function checks that the first byte read back matches the requested command
If it does not it will retry the request until retryCount is exhausted (default is 3 times)
Under most circumstances you should use the appropriate function instead of RawRead
"""
while retryCount > 0:
self.RawWrite(command, [])
rawReply = self.i2cRead.read(length)
reply = []
for singleByte in rawReply:
reply.append(singleByte)
if command == reply[0]:
break
else:
retryCount -= 1
if retryCount > 0:
return reply
else:
raise IOError('I2C read for command %d failed' % (command))
Please bear with me.
I'm trying to use the II2CDevice.Read(int length) method to bring back a six-byte array off the bus. The behavior, though, is that it is bringing back six copies of the FIRST byte of the bus. I've tried this many times, many ways, and all I get back is six of the same byte. Note also, this is a purchased I2C device (a Thunderborg) so I am unable to change its behavior. I've seen in a similar bug elsewhere that the solution was to change a connected Arduino's code to work in a specific way. I've also seen that I should be able to access the underlying WiringPi.Read(int fd, int length) type function, but that is beyond my ken at the moment.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
This SHOULD produce 0x99/0x15/0x00/0x00/0x00/0x00
Screenshots
It produces:
Desktop (please complete the following information):
Additional context
Any help would be appreciated.
The text was updated successfully, but these errors were encountered: