diff --git a/grove/grove_PM2_5_HM3301.py b/grove/grove_PM2_5_HM3301.py index 2cac0da..5360133 100644 --- a/grove/grove_PM2_5_HM3301.py +++ b/grove/grove_PM2_5_HM3301.py @@ -33,7 +33,6 @@ from smbus2 import SMBus , i2c_msg -from smbus2 import SMBusWrapper import time @@ -53,12 +52,12 @@ def __init__(self,bus_nr = 1): self.PM_10_conctrt_atmosph = 0 #PM10 Atmospheric environment concentration ,unit:ug/m3 - with SMBusWrapper(bus_nr) as bus: + with SMBus(bus_nr) as bus: write = i2c_msg.write(HM3301_DEFAULT_I2C_ADDR,[SELECT_I2C_ADDR]) bus.i2c_rdwr(write) def read_data(self): - with SMBusWrapper(1) as bus: + with SMBus(1) as bus: read = i2c_msg.read(HM3301_DEFAULT_I2C_ADDR,DATA_CNT) bus.i2c_rdwr(read) return list(read) @@ -93,7 +92,7 @@ def parse_data(self,data): print(" ") ''' -with SMBusWrapper(1) as bus: +with SMBus(1) as bus: write=i2c_msg.write(0x40,[0x88]) bus.i2c_rdwr(write)