STEAM blog

Computing, maths and art in education

Latest articles

Here are some of my latest blog articles. See the full index here.

Strange attractors

Fractals are closely related to iterated functions. This involves calculating the same function, over and over, each time feeding the result of the function back into the same function and calculating it again. When we plot the result, we sometimes find even very simple functions can create incredibly complex patterns. Iterated functions Here is a simple example of an iterated function in Python: x = 1 while true: print(x) x = -x/2 The function here is -x/2.
Read More…

Accessing Raspberry Pi desktop from a Windows PC

In a previous post, I shared my experience of connecting a Raspberry Pi terminal window accessing raspberry pi terminal remotely, giving me command line access to my Pi from another computer. This time, I would like to run the the Pi desktop on my Windows PC. In that way I can sit at my PC and see the Pi desktop, and open up GUI applications like Python IDLE or Scratch, using my PC mouse and keyboard.
Read More…

Accessing Raspberry Pi terminal remotely

My home Raspberry Pi setup isn’t ideal. The Pi is set up on a rickety little desk in the corner, which isn’t comfortable to sit at. It has an old “square” monitor (the first one I ever bought which wasn’t a CRT), and an old keyboard and mouse which don’t really work properly. As you can imagine, often when I think I might like to try something out on the Pi, I end up doings something else on the PC instead.
Read More…

Raspberry Pi remote access - overview

These articles describe how you can access your Raspberry Pi remotely from a PC. This also allows you to run the Pi “headless”, without a monitor or keyboard/mouse. This is ideal if you don’t have the spare kit, or maybe not even the desk space to set them up. All you need is a spare network connection and a USB phone charger for power. If you are using your Pi to learn about networking, Linux, web servers etc, it is just as easy to run up a terminal window on your PC.
Read More…

Transferring files between a Raspberry Pi and a PC

If you have followed the previous posts about accessing a Raspberry Pi remotely from a Windows PC, you should now be able to log on to your Pi desktop remotely from a PC. The next this you will probably want to so is to transfer files between your Pi and PC. This post shows what I think is the easiest way to do this. There are several articles online showing how to use Samba to make the Pi appear as an external disk drive on the PC.
Read More…

Fractals in Python

In this project we will look at various types of fractals, and use Python generate fractal images.

Passing values into functions

If you have learnt a bit of Python already, you probably understand the basics of function parameter passing. But you might also be aware that, in some cases, when you pass an object into a function, the object itself can be changed after the function returns. It is important to understand how and why this can happen. Fortunately it isn’t complicated. But first, forget anything you might have read about call-by-value and call-by-reference, or any comparisons with C or Java.
Read More…

Global variables and the global keyword

In this article we will look at the issues around using global variables in Python, the use of the global keyword, and an alternative (and better) method of implementing global data. Global and local variables You may have heard people say that you should never use global variables. It is certainly true that in a large, complex program, misuse of global variables can cause a lot of problems. But if you have ever written a simple Python script, you will most certainly have used global variables already.
Read More…

Flask webserver - adding a detail view

We previously created a page which listed all the fruits in our database. This time we will create another page which displays the details for a particular fruit. The template Here is our database table, containing the name, colour and image file name for various fruits: name color image Plum Purple plum.jpg Orange Orange orange.jpg Banana
Read More…

Virtual LED Hat game of life

In this article we will use the virtual LEDHat to create a simple animated game of life. You can find the source code on github.Game of life The Game of Life is a simulated 2 dimensional universe containing a grid of cells. As the cells are born and die, they form ever evolving patterns. The rules of the game are very simple, but the behaviour can be complex and fascinating.
Read More…