ev3dev python电源脚本

ev3dev python电源脚本,python,Python,ev3dev stretch版本2019年4月14日从此处下载 运行此python脚本以查看我的ev3dev上的电源发生了什么。除了注释掉的代码(报告为未知变量)之外还能工作 这个应该读什么 #!/usr/bin/env python3 from ev3dev2.power import PowerSupply power = PowerSupply() print("amps",power.measured_amps) print("volts",power.measured_volts)

ev3dev stretch版本2019年4月14日从此处下载

运行此python脚本以查看我的ev3dev上的电源发生了什么。除了注释掉的代码(报告为未知变量)之外还能工作

这个应该读什么

#!/usr/bin/env python3
from ev3dev2.power import PowerSupply

power = PowerSupply()
print("amps",power.measured_amps)
print("volts",power.measured_volts)
print("type",power.type)
print("max_voltage",power.max_voltage)
print("min_voltage",power.min_voltage)
#print("measured voltage",measured_voltage)
#print("measured current",measured_current)
您没有定义测量的_电压和测量的_电流变量。试试这个:

print("measured voltage",power.measured_voltage)
print("measured current",power.measured_current)