初始化提交

This commit is contained in:
王立帮
2024-07-19 10:16:00 +08:00
parent 4c7b571f20
commit 4a2d56dcc4
7084 changed files with 741212 additions and 63 deletions

View File

@@ -0,0 +1,27 @@
from microbit import *
import math
_VOLTAGE_POWER = 5
_RS = 10
_B = 3950
_T1 = 273.15 + 25
_R1 = 100
def read(pin, r1, b, rs):
r1 = r1 / 1000
rs = rs / 1000
# print("rs:" + str(rs))
_analogValue = pin.read_analog()
_voltageValue = (_analogValue / 1545) * _VOLTAGE_POWER
# print("voltageValue:" + str(_voltageValue))
_rt = ((_VOLTAGE_POWER - _voltageValue) * rs) / _voltageValue
# print("rt:" + str(_rt))
_tempValue = (((_T1 * b) / (b + _T1 * math.log(_rt / r1))) - 273.15)
return _tempValue