Sensirion / python-i2c-driver

Python package of a common I2C driver
https://sensirion.github.io/python-i2c-driver/
BSD 3-Clause "New" or "Revised" License
3 stars 3 forks source link

I2cConnection no attribute 'write_read' #2

Open izkim opened 1 month ago

izkim commented 1 month ago

Hi, we are using a SCD30 sensor for a capstone project. We downloaded the sensirion_i2c_driver and the sensirion_i2c_scd30 packages to our RaspberryPi 3. After initializing the scd30 device, we try to use any of the package's functions start_periodic_measurement(), get_data_ready()) and get the following error: 'I2cConnection' object has no attribute 'write_read'. I've been able to initialize data measurement using SMBus, but don't want to have to do that for every data measurement and polling as well. The issue comes any time we try to call the scd30 object. I've attached the code as well. Thank you! scd30_test.txt

psachs commented 1 month ago

Please check out the linux i2c example of the SC30 I2C driver on how to use it on Raspberry Pi. You need to create a LinuxI2cTransceiver to communicate through I2C on linux and can't just provide the I2C path directly to the connection.

https://github.com/Sensirion/python-i2c-scd30/blob/master/examples/example_linux_scd30.py

I hope this helps. Kind regards, Pascal