ltkda.blogg.se

ARDUINO WIRE LIBRARY ARDUINO WIRE LIBRARY vs smbus
ARDUINO WIRE LIBRARY ARDUINO WIRE LIBRARY vs smbus






ARDUINO WIRE LIBRARY ARDUINO WIRE LIBRARY vs smbus

Hi, I have exactly the same problem as above. dataNo, so this is how many bytes to send - currently hard-coded at 4īyte output = // This is just some sample data for testing Serial.print("I'm doing something else.")

ARDUINO WIRE LIBRARY ARDUINO WIRE LIBRARY vs smbus

Print ("We are requesting ", 4, " bytes of data") Print ("We received ", numBytes, " of data") Here is my code for the Pi: from smbus2 import SMBus So it is not clear to me what I2C functions I can do with Wire other than read and write single bytes. For example, there is no obvious implementation of the smbus2.read_i2c_block_data or write_i2c_block_data, or several other I2C function, nor does Wire implement the register/cmd byte. I've also noted that the Wire module appears to take an abbreviated approach. I've read that this is sometimes related to there being nothing on the other end of the i2c bus, but I can't see where the problem is. Line 17 is the " x = bus.read_i2c_block_data(address, 0, numBytes)" line. X = bus.read_i2c_block_data(address, 0, numBytes)įile "/usr/local/lib/python3.4/dist-packages/smbus2/smbus2.py", line 391, in read_i2c_block_data I continue to get the following error no matter what I try: Traceback (most recent call last):įile "/home/pi/sketchbook/I2Ctalk04/I2Ctalk04.py", line 36, in įile "/home/pi/sketchbook/I2Ctalk04/I2Ctalk04.py", line 25, in readBunchOfDataįile "/home/pi/sketchbook/I2Ctalk04/I2Ctalk04.py", line 17, in readBlockData But I'm not having any success passing an array of bytes using smbus2.read_i2c_block_data. I've had success using single byte read and write requests to pass single bytes of data back and forth. I'm working on a project where an Arduino will be sending data from approximately 50 sensors back to an RPi over I2C (RPi is master, Arduino is slave).








ARDUINO WIRE LIBRARY ARDUINO WIRE LIBRARY vs smbus