Hardware Reference
In-Depth Information
Module in the Python shell screen. If you do this for the
LEDblink
program, you will
get an error message explaining that you do not have the correct permissions to run
this program. he hardware of the Raspberry Pi is only accessible to the super user
(root) and not the user account you logged in as. Using
sudo
temporarily gives you
super user privileges so that you do not need to log out and back in to run a program.
Instead, you need to open an LXTerminal window and type the following command to
move into the folder or directory where you have saved your Python program:
cd Documents
hen type the following line to run the program:
sudo python3 LEDblink.py
Is that cool or what!
To interrupt the program and return to the command line in LXTerminal, press CTRL
+ C on the keyboard. Figure 8-9 shows the code.
FIGURE 8-9
Programming in Python 3 on Raspberry Pi to make an LED blink