ev3dev延伸版本2019年4月14日从此处下载...
https://github.com/ev3dev/ev3dev-lang-python
运行此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)
答案 0 :(得分:1)
您没有定义measured_voltage
和measured_current
变量。试试这个:
print("measured voltage",power.measured_voltage)
print("measured current",power.measured_current)