User manual

28
Fig. 2.7: An LED at GPIO port 25
2.4.1 How does it work?
The example shows the essential basic functions of the RPi.GPIO library.
import RPi.GPIO as GPIO The library RPi.GPIO must be imported into every Python program, that you are
going to use. By using the prefix
GPIO this notation can call all functions of the library.
import time The often used Python library time has nothing to do with GPIO programming. It contains
functions in terms of time and date calculation, including the
time.sleep function, which helps to
implement waiting times in a program in a very simple way.
GPIO.setmode (GPIO.BCM) When you start with any program the designation of GPIO ports must be
defined. Typically the default numbering
BCM is used.