update
This commit is contained in:
parent
6ae0477314
commit
4c742656b4
|
@ -165,11 +165,15 @@ def get_data():
|
||||||
# 二进制转换为16进制:010304010802307b79
|
# 二进制转换为16进制:010304010802307b79
|
||||||
return_data_hex = str(return_data.hex())
|
return_data_hex = str(return_data.hex())
|
||||||
# print('返回的数据转换为16进制:', return_data_hex)
|
# print('返回的数据转换为16进制:', return_data_hex)
|
||||||
print("当前风向为:", int(return_data_hex[6:10], 16))#单位mm
|
print("当前风向为:", int(return_data_hex[6:10], 16) / 10) #单位mm
|
||||||
winddirection_data = int(return_data_hex[6:10], 16)
|
winddirection_data = int(return_data_hex[6:10], 16) / 10
|
||||||
|
winddirection_data2 = int(return_data_hex[10:14], 16)
|
||||||
|
print("当前风向为2:", winddirection_data2) # 单位mm
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
# print('{"name":"%d","name1":"%d"}', 123,456)
|
# print('{"name":"%d","name1":"%d"}', 123,456)
|
||||||
# data = [{'ngvhgv': airtemp_data}, {'nvjgvjvj':airhumi_data}]
|
# data = [{'ngvhgv': airtemp_data}, {'nvjgvjvj':airhumi_data}]
|
||||||
|
else:
|
||||||
|
print("故障")
|
||||||
data = {'ambient_temperature': airtemp_data,
|
data = {'ambient_temperature': airtemp_data,
|
||||||
'ambient_humidity': airhumi_data,
|
'ambient_humidity': airhumi_data,
|
||||||
'carbon_dioxide': co2_data,
|
'carbon_dioxide': co2_data,
|
||||||
|
|
Loading…
Reference in New Issue