代码拉取完成,页面将自动刷新
#!/usr/bin/env python3
import sys
from dali.driver import hasseb
from dali import bus
from dali import address
import dali.gear.general as gear
# Create hasseb USB DALI driver instance to handle messages
DALI_device = hasseb.SyncHassebDALIUSBDriver()
# Create DALI bus
DALI_bus = bus.Bus('hasseb DALI bus', DALI_device)
# Print help if no arguments
if len(sys.argv) == 1:
print("Give test number as an argument")
print("1: Initialize bus")
print("2: Scan bus")
# Make test if only one argument
elif len(sys.argv) == 2:
# Initialize bus
if sys.argv[1] == '1':
print("Initializing bus...")
DALI_bus.initialize_bus()
print("Address | Random address | Groups | Device type")
for i in range(len(DALI_bus._devices)):
print(f"{DALI_bus._devices[i].address} | {DALI_bus._devices[i].randomAddress} | {DALI_bus._devices[i].groups} | {DALI_bus._devices[i].deviceType}")
# Scan bus
elif sys.argv[1] == '2':
print("Scanning bus...")
DALI_bus.assign_short_addresses()
print("Address | Groups | Device type")
for i in range(len(DALI_bus._devices)):
print(f"{DALI_bus._devices[i].address} | {DALI_bus._devices[i].groups} | {DALI_bus._devices[i].deviceType}")
else:
print(f"Invalid argument {sys.argv[1]}")
# Print error if invalid argument
else:
print("Give only one argument")
# adr = address.Short(0)
# print(DALI_device.send(gear.QueryActualLevel(adr)))
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。