Herunterladen Inhalt Inhalt Diese Seite drucken

SunFounder Da Vinci Kit Bedienungsanleitung Seite 376

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
GPIO.output(row, GPIO.HIGH)
for
j, col
index
(GPIO.input(col)
if
pressed_keys.append(self.keys[index])
GPIO.output(row, GPIO.LOW)
pressed_keys
return
################ EXAMPLE CODE START HERE ################
count
=
0
pointValue
=
0
upper=99
lower=0
def
setup():
global
keypad, last_key_pressed,keys
rowsPins
=
[18,23,24,25]
colsPins
=
[10,22,27,17]
keys
=
["1","2","3","A",
"4","5","6","B",
"7","8","9","C",
" *
","0","#","D"]
keypad
=
Keypad(rowsPins, colsPins, keys)
last_key_pressed
LCD1602.init(0x27, 1)
LCD1602.clear()
LCD1602.write(0, 0, 'Welcome!')
LCD1602.write(0, 1,
def
init_new_value():
global
pointValue,upper,count,lower
pointValue
=
random.randint(0,99)
upper
=
99
lower
=
0
count
=
0
print('point is %d'
def
detect_point():
global
count,upper,lower
if
count
>
pointValue:
if
count
<
upper:
upper
=
elif
count
<
pointValue:
if
count
>
lower:
lower
=
elif
count
==
pointValue:
count
=
0
return
1
count
=
0
return
0
def
lcd_show_input(result):
LCD1602.clear()
if
result
==
1:
LCD1602.write(0,1,'You have got
372
in
enumerate(self.colsPins):
=
i
len(self.colsPins)
*
==
1):
=
[]
# init(slave address, background light)
'Press A to
Start!')
%(pointValue))
count
count
it!')
+
j
Kapitel 1. Über das Da Vinci Kit
(Fortsetzung der vorherigen Seite)
(Fortsetzung auf der nächsten Seite)

Werbung

Inhaltsverzeichnis
loading

Verwandte Produkte für SunFounder Da Vinci Kit

Diese Anleitung auch für:

Davinci-kit-for-raspberry-pi

Inhaltsverzeichnis