update
This commit is contained in:
@@ -48,9 +48,11 @@ ser = serial.Serial(
|
||||
timeout = 0.5
|
||||
)
|
||||
|
||||
# 1️⃣ Request PM Data (PM1, PM2.5, PM10)
|
||||
|
||||
#ser.write(b'\x81\x11\x6E') #data10s
|
||||
ser.write(b'\x81\x12\x6D') #data60s
|
||||
|
||||
time.sleep(0.5) # Small delay to allow the sensor to process the request
|
||||
|
||||
#print("Start get_data_v2.py script")
|
||||
byte_data = ser.readline()
|
||||
@@ -61,8 +63,9 @@ PM1 = int.from_bytes(byte_data[9:11], byteorder='big')/10
|
||||
PM25 = int.from_bytes(byte_data[11:13], byteorder='big')/10
|
||||
PM10 = int.from_bytes(byte_data[13:15], byteorder='big')/10
|
||||
|
||||
# Write command to retrieve temperature and humidity data
|
||||
# 2️⃣ Request Temperature & Humidity
|
||||
ser.write(b'\x81\x14\x6B') # Temp and humidity command
|
||||
time.sleep(0.5) # Small delay to allow the sensor to process the request
|
||||
byte_data_temp_hum = ser.readline()
|
||||
|
||||
# Decode temperature and humidity values
|
||||
|
||||
Reference in New Issue
Block a user