Thursday, June 14, 2018

No input enabled while your app in docker container on Raspberry Pi

If you happen to go through this issue, the solution is very well explained in this SO answer, and the reason is a Docker container does not, by default, have access to any host devices.

Tuesday, May 29, 2018

Sense HAT & Sense Emulator = a perfect couple

If you're a Raspberry fan, chances are you already know about Sense HAT. It's an add-on board that provides an 8×8 RGB LED matrix, a five-button joystick and sensors: gyroscope, accelerometer, magnetometer, temperature, barometric pressure, humidity. A good thing is a "official" Python library supporting easy access to that hardware.

But a better thing is the Sense Emulator, an interactive application providing an interface for emulating the Sense HAT hardware. The idea is that you can develop a Python application intended to interact with the Sense HAT hardware without worrying about actually having such board at hand.

The way it works is that when working with the emulator within your Python application, you create a main class SenseHat giving accesss to all sensors, the LED pixel display, and the joystick. If you follow the recommendation of importing the library with the following idiom:
from sense_emu import SenseHat
then when you wish to deploy your code on an actual Sense HAT board the only change you need to make is to that line, changing it to:
from sense_hat import SenseHat
Fantastic! One line change it's all you need to move from sotfware emulation to actual hardware. Everything remains the same in your code.

Sunday, March 25, 2018

Regulable power supply

Are you wondering what this post has to do with a Raspberry Pi? I'd say a lot, since one of the magic things of working with a RPi is the ability to connect to thousands of circuits via its GPIO. On doing so, you may need 3.3 volts, or just 5 as a USB cable, why not 12 for DC motors?, etc.