![Joy-it MOTOPI Manual Download Page 7](http://html1.mh-extra.com/html/joy-it/motopi/motopi_manual_2027334007.webp)
www.joy
-
it.net
Pascalstr. 8 47506 Neukirchen
-
Vluyn
6. CONTROLL OF THE ADDITIONAL CONNECTIONS
After the restart, you must install the necessary drivers and modules.
Therefore perform the following commands:
sudo apt
-
get update
sudo pip install spidev
sudo pip install wiringpi
A restart is now required again.
sudo reboot
After the restart, the connections are ready to use.
Please note that the first pin of the digital connection is connected with
the GPIO pin 27 and the second pin to the GPIO pin 22.
7. CODE EXAMPLE TO USE THE DIGITAL CONNECTIONS
Here, you have a short code example for controlling the digital connec-
tions. For that, we use the
LK
-
Button1 with a LK
-
Cable
-
20 from our Lin-
kerKit series.
import
RPi.GPIO
as
GPIO
from
time
import
sleep
#Initialisiere Button auf Digital
-
PIN 22
button =
22
GPIO.setwarnings(
False
)
GPIO.setmode(GPIO.BCM)
GPIO.setup(button, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while
True
:
if
GPIO.input(button) == GPIO.HIGH:
#Mache etwas
"Ich tue etwas"
else
:
#Mache etwas anderes
"Ich tue etwas anderes"