如何使用 Python 计算分压器输出电压
你可以使用 UliEngineering 库通过顶部电阻、底部电阻和输入电压计算分压器的输出电压:
voltage_divider_example.py
from UliEngineering.Electronics.VoltageDivider import *
# 具有 1MΩ 和 150kΩ 电阻及 24V 输入电压的分压器
print(voltage_divider_voltage("1MΩ", "150kΩ", "24V")) # 打印 3.1304347826086953你也可以使用 auto_format() 直接格式化此电压:
voltage_divider_format_example.py
from UliEngineering.EngineerIO import auto_format
# 格式化为伏特打印
print(auto_format(voltage_divider_voltage, "1MΩ", "150kΩ", "24V")) # 打印 "3.13 V"Check out similar posts by category:
Electronics, Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow