Calling C++ Classes from Python, with ctypes…

I recently found myself needing to call a C++ class from within Python. I didn’t want to call a separate process (as I had previously when using Thrift – see Using Apache Thrift for Python & C++); but rather to call a C++ library directly. Before I go on I should say that there are a […]

Simple Python Hello World with Alexa

I’ve recently got myself an Amazon Echo Dot; Amazon’s speech-based, voice-controlled device using Amazon’s Alexa, digital assistant. They’re pretty nice devices; and they’re quite fun to play with (and not too expensive either) – though I’ve not had it long enough to say if it’s actually useful yet… Obviously the first thing that I did with […]

Apache Thrift Tutorial — Part 2

Last time we looked at how to write a server application in C++, and call it from Python. This time, we’ll do things the other way around: implementing a service in Python, and calling from C++.

Using Apache Thrift for Python & C++

Apache Thrift is a software framework for cross-language: providing what is essentially a remote-procedure call interface to enable a client application to access services from a service — which can be written in the-same, or another language. Thrift supports all of the major languages that you’d expect to use: including Python, C++, Java, JavaScript / […]

RegEx Golf

Inspired by the famous XKCD cartoon that started it and by Google’s Peter Norvig over on O’Reilly.com I decided to play some RegEx Golf myself this Easter… If you’re not familiar with the game – the idea is to write the shortest regular expression possible that will select every element of a list, without selecting […]

Arduino I2C with the MCP9808 Temperature Sensor

[latexpage]The Microchip MCP9808 is a high precision temperature sensor with an I2C interface – making it easy to interface with microcontroller or embedded Linux electronics. The chip has a very small form-factor: available as either an 8-pin DFN package – or an 8-pin MSOP package. For hobbiest purposes DFN is almost impossible to use due […]

Arduino & XBee

Xbee modules provide a very simple way to add a wireless capability to communications on Arduino. Essentially they let you work in exactly the same way as a direct serial connection between two boards – albeit wirelessly. The easiest way to connect an Xbee to your Arduino, is to use the Arduino Wireless Shield. It’s […]

GPIO with sysfs on Raspberry Pi (Part 2)

In my last post on using sysfs for GPIO on Raspberry Pi, I showed you how you can use the sysfs file system to manipulate the state of the GPIO pins. This time, we’re going to explore how to do the same thing programmatically. I’m going to walk you through developing a C library to […]

GPIO with sysfs on a Raspberry Pi

EDIT (August 2023) – The technique outlined here will still work, but it’s been deprecated for some time now – so I’ve written a new post about how to use the new methods… The Raspberry Pi (in case you’ve been living under a rock for the last six-months) is a cheap ($25) ARM Linux computer, primarily […]

Arduino Seven-Segment Display

Here’s a video that I made, talking about one way to use seven-segment displays with a microcontroller.