My workshop notes that build on the previous session where we assembled their Raspberry Pi. We will first review what we have done during the previous session, put the Raspberry Pi systems back together into a useful computer, then take a look at the network, web pages, and some coding.
Review What We Did Last Time
During lunch we review what a Raspberry Pi is. On a provided worksheet will try to review what the parts are:
- Difference between HDMI, USB, Ethernet, and WiFi.
- What is the difference between the Operating System and an Application?
- What is the command-line, also known as console?
- What is the graphical user interface?
- What is the difference between the two?
Assemble the Computers and Get Them Working Again
After lunch all the kids will re-assemble their computers. Are you able to get yours to start?
Make Sure We Are All On The Same Page
Open a command-line shell.
Now, get some command-line games:
sudo apt-get install --yes --fix-missing nsnake ninvaders bastet pacman4console
Try some of the games. Type
pacman4console on the command-line.
Let’s also add a game (alex4 and minecraft), some coding apps (scratch2), a web browser (chromium) and some tools (gedit) for the graphical user interface:
sudo apt-get install --yes --fix-missing scratch2 minecraft-pi alex4 chromium-browser gedit
When asked, click OK for message about Flash.
Check if Minecraft works.
Let’s See What the Internet Really Looks Like
You just installed some software (
nsnake) or (
minecraft-pi). When you told it to install it (
apt-get install nsnake) your Raspberry Pi went out to the Internet, downloaded the software, and put it into your Raspberry Pi so that you can play with it.
Open the web browser (Raspberry logo, Internet, Chromium Web Browser) and point it to: http://www.kremkow.com/2018/02/raspberry-pi-networking-and-coding-workshop/
Now you can follow the instructions on your screen instead of on paper.
Now point the web browser to: http://www.kremkow.com/raspberry-pi-workshop
Right-click “hello-world.html” that is shown, select “Save link as…”, choose your Desktop, then press “Save”.
On your desktop “hello-world.html” should have appeared. Right-click it. In the menu, under “Open” you should see “Chromium”. Open it with Chromium. Same page!
But take a look at the address bar. Before it said “http://www.kremkow.com/raspberry-pi-workshop/hello-world.html”. Now it says “file:///home/pi/Desktop/hello-world.html”.
Again, back to your desktop, right-click the file. In the menu, under “Open” you should see “Text Editor”. Open it with the editor. Sure looks different now – but it’s the same page!
See all this text? Why don’t you change it? Put your name where it says “ME” and then press “Save” (in the menu on the right). Now close the editor.
Go back to the browser, press Ctrl-R or the Reload icon to read the file again. See how it’s changed?
But so far, you are the only one who can see the file on your computer.
Wouldn’t it be fun to be able to see everyone else’s file too?
For that we’ll need to install a web server on the Raspberry Pi:
sudo apt-get install --yes --fix-missing apache2
Now, start Apache.
sudo systemctl restart apache2
Now, visit your own web server here: http://127.0.0.1/
You should see a message about a Debian Apache web server default page.
Let’s copy our “hello-world.html” file over to where the web server can find it.
sudo mv ~/Desktop/hello-world.html /var/www/html/index.html
Now change who owns the file back to you so that you can edit it again.
sudo chown pi.pi /var/www/html/index.html
Take another look at http://127.0.0.1/ – your file should be there now!
If you want to edit your file some more, just call:
Try to guess who these web pages belong to:
Close your command-line, web browser, and anything else you might have open.
Visit https://scratch.mit.edu/projects/10015059/ for inspiration.
Let’s discuss what you would like to do next.