如果输入大于或小于变量的值,我想为while循环实现一个函数,以更新变量的值。
现在我要在鬃毛函数中声明变量时使它起作用,如果我直接在while循环中对该函数进行硬编码没有问题并设法升级该变量。但是,当我使用变量作为参数调用a函数时,该值不会升级。
this.textoFormat += this.texto.join('\n');
def main():
MaxTemp = 1
MaxHum = 1
LowestHum = 100
LowestTemp = 100
sensor = GroveTemperatureHumiditySensorSHT3x()
while True:
temperature, humidity = sensor.read()
if(temperature > MaxTemp):
MaxTemp = temperature
if(temperature < LowestTemp):
LowestTemp = temperature
if(humidity > MaxHum):
MaxHum = humidity
if(humidity < LowestHum):
LowestHum = humidity
Display(humidity,temperature,MaxHum,LowestHum,MaxTemp,LowestTemp)
def SetMinAndMax(MaxTemp,MaxHum,LowestTemp,LowestHum,temperature,humidity);
if(temperature > MaxTemp):
MaxTemp = temperature
if(temperature < LowestTemp):
LowestTemp = temperature
if(humidity > MaxHum):
MaxHum = humidity
if(humidity < LowestHum):
LowestHum = humidity
def main():
MaxTemp = 1
MaxHum = 1
LowestHum = 100
LowestTemp = 100
sensor = GroveTemperatureHumiditySensorSHT3x()
while True:
temperature, humidity = sensor.read()
SetMinAndMax(MaxTemp,MaxHum,LowestTemp,LowestHum,temperature,humidity)
Display(humidity,temperature,MaxHum,LowestHum,MaxTemp,LowestTemp)