Introduction to Green Code


This document explains the basics of Green Code and some of the design decisions that were made. If you just want to get started, you might be better off just consulting the Green Code Dictionary.

Why is it called Green Code?

The primary reason is, of course, because of its potential use in environmentally friendly low-power LED Grid based applications, and the obvious Matrix allusion.

In an early 8x1 version, all the characters were in green, but since we moved to a 4x1 RGB format, we found that blue and red gave a greater contrast against the white plastic LED housing that many of the common devices have. However, as we shall see, the green square is the most important control code, so there is still quite a bit of the colour green in Green Code.

What is Green Code?

Green Code is a visual language with each character represented by four coloured squares in a 4x1 grid (like the long thin block in the video game Tetris).

There is also an alternative black and white representation which uses a 4x2 grid for each character. Obviously this is 50% less space efficient, but it can be used on single colour (i.e. on and off) LED grids without having to learn a second visual language.

Green Code provides a lot of characters, which aim to more or less represent the first block of characters in Unicode. This first block is formally known as ISO/IEC 8859-1 but is commonly referred to as 'Latin alphabet no. 1' or as 'Western European languages'. This block provides the characters needed for 28 languages and partial support for 13 more.

Obviously, you only need to learn the characters useful for your own language(s). If like me your primary language is English, you only really need to learn the 26 letters, 10 digits and a few punctuation characters.

If you want to encode a non-Latin script language (e.g. Chinese), then you will need to invent your own encoding. If you do, then please let me know, it would be pretty interesting to see what you come up with!

What are the basics?

The character shown above represents a space. It is four blank squares. A blank square represents an LED turned off, they are white here because this web page happens to white; if the background of this page was black, these blank squares would be black.

This is the letter e. It has one blue square (and three off squares). The colour blue represents dark or short (aka dot/dit).

This is the letter t. It has one red square (and three off squares). The colour red represents light or long (aka dash/dah).

Now blue-red or (or short-long or dit-dah) is a. As you may have already noticed, the English characters are based on morse code.

Extra characters such as digits were fairly sensible in Morse's original 1844 code, but when it became standardised in 1865, it became the proverbial horse designed by committee.

The digits and punctuation characters got longer and longer. The problem being, that when you break the 4 character max-length, a longer character risks being mistakenly decoded instead as two constituent characters, e.g. the word 'he' and the number 5 are both five dots (blue).

This ambiguity would be compounded in Green Code as we use spaces between words, not between characters.

Above is a word in Green Code, as you can see, characters are built up vertically and then combined horizontally to form words.

Therefore in Green Code, the character length is always four, and extra colours are used to extend the character set. Mostly these extra colours are used in the top position, so you can treat them like 'control characters' to distinguish between different blocks of characters.

So if a character starts with blue or red, it is probably a basic letter. If a character starts with green, it is probably a digit and so on.

Digits


Digits all start with a green square. If you know Roman numerals, the three lower squares are very simple.

If you look at the character 0, it has a green square and three blank squares.

Now look at the character 1. It has a blue square in second position. You can think of it like I in Roman numerals.

Now look at the character 5. It has a red square in second position. You can think of it like V in Roman numerals.

8 is the one that doesn't immediately translate to Roman, however I like to pretend there is another (hidden) red square below it, i.e. IIVV, and V+V=X so IIX which is 8 (correct Roman 8 is VIII of course, but that doesn't fit either).

Letters

Here are the English characters in Green Code. Like in Morse Code, there is no upper and lower case, only one case, which for uniformity, we always represent in letters as lower case.

For most of human history, they did without an upper and lower distinction, you won't miss them. Also note that the alphabet is typically not the best layout for learning.

More

Carry on by looking at the full Green Code Dictionary, or look at some common words.