Herunterladen Inhalt Inhalt Diese Seite drucken

SunFounder Da Vinci Kit Bedienungsanleitung Seite 124

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
state
else:
continue
state
==
if
if
current
current_length
state
else:
continue
state
==
if
if
current
lengths.append(current_length)
state
else:
continue
if
len(lengths)
#print ("Data not good, skip")
return False
shortest_pull_up
longest_pull_up
halfway
=
(longest_pull_up
bits
=
[]
the_bytes
=
[]
byte
=
0
for
length
in
lengths:
bit
=
0
if
length
>
bit
=
1
bits.append(bit)
#print ("bits: %s, length: %d" % (bits, len(bits)))
for
i
in
range(0, len(bits)):
byte
=
byte
if
(bits[i]):
byte
=
else:
byte
=
if
((i
+
1)
the_bytes.append(byte)
byte
=
#print (the_bytes)
checksum
=
(the_bytes[0]
if
the_bytes[4]
#print ("Data not good, skip")
return False
return
the_bytes[0], the_bytes[2]
def
main():
while
True:
result
=
readDht11()
if
result:
humidity, temperature
print
("humidity:
time.sleep(1)
120
=
STATE_DATA_PULL_UP
STATE_DATA_PULL_UP:
==
GPIO.HIGH:
=
0
=
STATE_DATA_PULL_DOWN
STATE_DATA_PULL_DOWN:
==
GPIO.LOW:
=
STATE_DATA_PULL_UP
!=
40:
=
min(lengths)
=
max(lengths)
+
shortest_pull_up)
halfway:
<<
1
byte
|
1
byte
|
0
%
8
==
0):
0
+
the_bytes[1]
!=
checksum:
=
result
%s
%%,
/
2
+
the_bytes[2]
Temperature:
%s
C`"
(Fortsetzung der vorherigen Seite)
+
the_bytes[3])
&
%
(humidity, temperature))
(Fortsetzung auf der nächsten Seite)
Kapitel 1. Über das Da Vinci Kit
0xFF

Werbung

Inhaltsverzeichnis
loading

Verwandte Produkte für SunFounder Da Vinci Kit

Diese Anleitung auch für:

Davinci-kit-for-raspberry-pi

Inhaltsverzeichnis