User manual
44
Later, when in parallel with the ASCII character the ANSI character set was introduced, which is used by
older versions of Windows, the very same mistake happened again. When the German umlauts and other
accented characters were allocated other places in the character set than in the standard of ASCII, the
linguistic chaos reached perfection.
As a solution to the problem, Unicode, which can represent all possible languages, including Egyptian
hieroglyphics, cuneiform and Vedic Sanskrit, the oldest recorded written language in the world was
introduced in the 90s. UTF-8, an encoding that works across platforms and that is congruent with the first
128 characters in ASCII - and therefore backward compatible with almost all text performing systems - is
the most commonly used form to encode Unicode characters in plain text files. The coding is shown in a
comment line. All lines beginning with the character # will not be evaluated by the Python interpreter. The
encoding which must always stand at the very beginning of a program, tells the Python shell, how to represent
characters; it is no real program statement. In the same way, you can also enter your own comments into the
programming code.
Comments in programmes
When you are writing a programme, you sometime don’t remember what was on your mind when you
wrote certain programme statements. Programming is one of the most creative activities, because you are
creating something merely based on your ideas and you are not limited by any materials and tools.
Comments are important, especially when you are writing programmes that also need to be understood
by another person, or which need further editing. In the sample programmes we did not include
comments to keep the programming code clear. All programme statements are described in detail.
There is always one question that arises for programmes that are published by non-English speakers:
Comments in English or German, for instance? If comments are in German, the French complain about
the incomprehensible language; sometimes you yourself don’t understand your own English comments
anymore, and the British laugh at your poor English.
button = 4
Light=[4,18,23,24,25]
For reasons of simplicity, we are adding an additional element with the number 4 and the GPIO port 25 to
the list for the button. That let’s you also easily select another GPIO port for the button, because its number
like the GPIO ports of LEDs appears only here in the program.
GPIO.setup (traffic light [button], GPIO.IN) The GPIO port of the button is defined as input.
These definitions are also done via
GPIO.setup, yet this time with the parameter GPIO.IN.
print (“Press button to turn on pedestrian light,
“Ctrl+C exits the program")