Raspberry Pi – Control a separate running script from a Web Server

Let’s say that you have a running Flask server and you want your user to control the state (on/off) of a motion sensor via the GPIO. The most complex way is to create a multi-threading script which handles the server and GPIO code.

Another approach is to separate the server script from the GPIO script. Thus having two layers of scripts. This has the advantage to debug in isolation. For this technique one has to use Unix Signals which can be used to send signals from one process to another.

When you execute a script on your UNIX system, the system creates a process id (pid) which is different every time. A signal is a software interrupt which notifies a process with a significant event or request.

Continue reading

Maltese Online Radio – Raspberry Pi

So here’s the story:

  1. I woke up to Mum complaining that she can’t listen any longer to the radio from our kitchen due to noise interference
  2. My brother suggested of buying an online radio
  3. I said “No..I can build one using the Raspberry Pi 2 and Music Player Daemon”
  4. I expected some excitement from their end but they just replied “ok”. Sad.
  5. Using the terminal I installed the player
Continue reading

Digital Game Based Learning – Learn Binary & Hexadecimal Conversions

Capture

Introduction

I created this game using Unity 3D for a teaching course. The game takes place in World War 2 and contains one single mission. A number of planes are inbound to destroy a town and the objective of the player is to stop the enemy. The player has to translate incoming messages by using ASCII encoding and destroy respective enemy planes.

This game supports assessment for:

  • Decimal to ASCII Encoding
  • Binary to ASCII Encoding
  • Hexadecimal to ASCII Encoding
Continue reading

Learn programming using Call of Duty 4

I’ve been talking with several young programming language students and many of them want to build and develop games. Some of them tried Unity 3D and Unreal Engine on their own but they found the engines very complex to use. I totally understand their situation. These types of engines are used by people that have good understanding in programming and 3D graphics. On the other hand this motivation should not be wasted! I think that at this stage, these students should try to modify high end games and at the same time learn the basics of programming rather than get into detail of how these game engines work.

Call of Duty 4 is the perfect solution for this objective. One can build mods using a programming language that is similar to C# and test the code in an online collaborative environment. I created some notes and decided to share them online. Feel free to use and enjoy 🙂

Continue reading

Photoshop – Data Driven Graphics

What is ‘Data Driven Graphics’?

Data-driven graphics make it possible to produce multiple versions of an image quickly and accurately for print or web projects. For example, you can produce 100 versions of a web banner with different text and images, all based on a template design.

In the following tutorial we are going to read data from a CSV file and automatically create a banner for every row contained in the below dataset.

Continue reading