ssh pi@raspberrypi.local
ls: list files in the directory.
ls
Bookshelf Documents Pictures rpi-led-strip Videos
Desktop Downloads Music Public Templates
cd: change directory.
cd rpi-led-strip
The example programs for controlling the LED's are in the pyLED subdirectory of the rpi-led-strip directory, so we'll go into the rpi-led-strip directory first. The command gives no response; many terminal commands are silent if successful. However, you should see your prompt change to reflect the new directory you're in. We can check that we're in the right directry with the pwd command.
pwd: print working directory.
pwd
/home/pi/rpi-led-strip
Prints the full path to the directory you're currently working in, which should be /home/pi/rpi-led-strip.
ls
error.log old-web README.md webServer
flags PI_SETUP.md ssh wpa_supplicant.conf
NOTES.txt pyLED testTime.html
cd pyLED
ls
aRainbow.py clearSwitch.py startup.py test2.py
clear.py rainbow.py test1.py test3.py
more: showing the contents of a file.
more test1.py
import board
import neopixel
pixels = neopixel.NeoPixel(board.D18, 20)
pixels[2] = (10,0,0)
This shows the entire contents of the test1.py file. For longer files you can tap the Space Bar to move forward a page, or Enter to move forward one line.
python3: calling the python interpreter to run a program.
python3 test1.py
Can't open /dev/mem: Permission denied
...
You'll see a long error output that starts with "Permission denied". Most python programs should not have this problem, but in order to control the LED's we need superuser permissions. We use sudo to aquire these permissions.
sudo: run a program with superuser status.
sudo python3 test1.py
You should get no response from the terminal window, but the third LED should light up and turn red.
cp: copy file
cp test1.py myTest1.py
ls
aRainbow.py clearSwitch.py rainbow.py test1.py test3.py
clear.py myTest1.py startup.py test2.py
Here we copy the test1.py file to a new file named myTest1.py, so when we try to make changes to the program (see next step), we won't run the risk of messing up a working program that we may need for reference.
nano: file editor
nano myTest1.py
There are a number of file editors available, but we'll use nano because it's easy enough. Here we open the file for editing.