Herunterladen Inhalt Inhalt Diese Seite drucken

SunFounder Da Vinci Kit Bedienungsanleitung Seite 340

Für den raspberry pi 4 modell b, 3 modell a +, 3 modell b +, 3 modell b, 2 modell b, 1 modell b +, 1 modell a +, zero w and zero
Inhaltsverzeichnis

Werbung

SunFounder Da Vinci Kit
upper_tem_setting()
else:
monitoring_temp()
def
destroy():
LCD1602.clear()
ADC0834.destroy()
GPIO.cleanup()
__name__
==
'__main__':
if
try:
setup()
while
True:
loop()
except
KeyboardInterrupt:
will be executed.
destroy()
Code Erklärung
def
get_joystick_value():
x_val
=
ADC0834.getResult(1)
y_val
=
ADC0834.getResult(2)
if(x_val
>
200):
return
1
elif(x_val
<
50):
return
-1
elif(y_val
>
200):
return
-10
<
50):
elif(y_val
return
10
else:
0
return
Diese Funktion liest die Werte von X und Y. Wenn X> 200 ist, wird "1" zurückgegeben. X<50, return "-1"; y> 200,
geben Sie "-10" zurück, und y<50, geben Sie "10" zurück.
def
upper_tem_setting():
global
upperTem
LCD1602.write(0, 0,
change
=
int(get_joystick_value())
upperTem
=
upperTem
LCD1602.write(0, 1, str(upperTem))
LCD1602.write(len(strUpperTem),1,
time.sleep(0.1)
This function is for adjusting the threshold and displaying it on the I2C LCD1602.
def
temperature():
analogVal
=
ADC0834.getResult()
Vr
=
5
float(analogVal)
*
Rt
=
10000
Vr
*
temp
=
1/(((math.log(Rt
Cel
=
temp
-
273.15
Fah
=
Cel
1.8
*
return
round(Cel,2)
336
# Program start from here
# When 'Ctrl+C' is pressed, the program destroy()
'Upper Adjust:
+
change
'
/
255
/
(5
-
Vr)
/
10000))
/
+
32
')
')
3950)
+
(1
/
(273.15+25)))
(Fortsetzung der vorherigen Seite)
Kapitel 1. Über das Da Vinci Kit

Werbung

Inhaltsverzeichnis
loading

Verwandte Produkte für SunFounder Da Vinci Kit

Diese Anleitung auch für:

Davinci-kit-for-raspberry-pi

Inhaltsverzeichnis