C++

last modified: October 23, 2025

How to Deal with Badly Written Code

Posted on 2018-08-31— C++, How and Why, Improve your Code

I often encounter poorly written C++ libraries, especially around hardware. In this post I outline four practical strategies—rewrite, refactor, wrap the library, or wrap the interface—to regain control, improve reliability, and reduce pain. Read on for pragmatic steps and examples you can apply to your projects.

Read this post

Make your Code Safe and Readable with Flags

Posted on 2018-05-06— C++, Improve your Code

I show how a small C++ flags template makes embedded register bitmasks safer and much easier to read. I'll explain why macros and CMSIS-style definitions lead to errors, and walk through clear C++11 examples and a simple driver. Read on to see the implementation and usage.

Read this post

How and Why to Avoid Preprocessor Macros

Posted on 2016-10-24

I explain why preprocessor macros often cause subtle bugs and naming conflicts in C++ and share safer alternatives—const/constexpr variables, #pragma once, enums, and separate implementation files. If you want clearer, type-safe code with unchanged performance, read the full post for practical examples and replacements.

Read this post

Lucky World – A jump'n'run game for MeggyJr RGB

Posted on 2014-12-17— Common

I've released Lucky World, a compact jump'n'run for the MeggyJr RGB featuring an intro, 16+ levels, secrets and an end scene. I squeezed it into ATmega328P limits and shared the sources under GPLv2. If you're curious, please read on for downloads, requirements, and play instructions.

Read this post

Source Code for Xmas Decoration on GitHub

Posted on 2014-12-01— Common

I documented the source code for my color-changing Xmas decoration and pushed it to GitHub, adding comments and safety notes about parts you shouldn't copy. If you're curious about the implementation or want to build your own, please view the repository and the full project description for details.

Read this post

A New Library for Meggy Jr RGB

Posted on 2014-11-13— Projects, Software

I rebuilt the Meggy Jr RGB library from scratch to make game development simpler on the ATmega328P. I focused on low memory use, frame‑synchronized loops with a back buffer, clear color handling, fast pixel operations, reliable button input and a background sound player. Read the post for examples and the GitHub release.

Read this post

How and Why to use Namespaces

Posted on 2014-10-31— C++, How and Why

I explain how C++ namespaces prevent name conflicts and why they matter, especially in Arduino projects. I walk through practical patterns—prefixing, selective using-declarations, and importing a namespace—with class and global examples. Read the full post for simple, pragmatic examples to keep your code clearer and conflict-free.

Read this post