TellyMate Shield - Examples

This page holds a collection of example sketches for your Arduino and TellyMate Shield. They range from the trivially simple 'Hello World' to the complex and (hopefully) entertaining 'Maze'.

The code isn't intended to be perfect, but may well be a useful starting point.

The .ino files are slightly updated versions, suitable for use with Arduino 1.0 onwards.

Contents

Hello World

Hello World

This is a version of the ubiquitous Hello World program, hand-crafted especially for the Arduino with a TellyMate Shield.

Required: Arduino
Optional: TellyMate Shield (it will output just as well to the Arduino IDE's serial monitor).

Title Version Date File Size
Hello World 2.0 2009-11-08  tms_hello_002.pde 194 Bytes

Random Characters

Photo of Random Characters taken at a rakish angle

This sketch sprays the screen with random characters.

The cursor is moved to a random location on the screen (using the <ESC>Y control code), and then a random character is sent. It demonstrates simple cursor movement.

Required: A TellyMate Shield

Title Version Date File Size
Random Characters 2.0 2012-02-18  tms_random_002.ino 1.3 kB
Random Characters 1.0 2009-05-15  tms_random_001.pde 1.2 kB

Read Test

Read Test

This simple sketch demonstrates how to return data from the TellyMate.

After telling the TellyMate to enable transmission, this sketch steps through each character location on the screen. At each location it reads the character, and replaces it with the next character in the character-set. whitespace characters are left alone.
Once the whole screen has been completed, the process starts again at the top.

The 'diagnostic information' output (<ESC>Q) is used as the 'seed' screen data.

Required: A transmit-capable TellyMate shield.

Title Version Date File Size
ReadTest 2.0 2012-02-18  tms_readtest_002.ino 3.4 kB
ReadTest 1.0 2009-06-16  tms_readtest_001.pde 3.1 kB

Wanderers

Wanderers

26 characters are allowed to wander randomly around the screen.

This example demonstrates a simple method of collision detection:
Before a character is moved, the new position is 'read' and the character is only allowed to move if it is blank.
This simple rule means that the characters stay within the 'playing area', and never overwrite each other.

Required: A transmit-capable TellyMate shield.

Title Version Date File Size
Wanderers 2.0 2012-02-18  tms_wanderers_002.ino 6.4 kB
Wanderers 1.0 2009-06-16  tms_wanderers_001.pde 6.1 kB

Batsocks Paint

Batsocks Paint

A very simple character painting program. It uses 6 buttons: 4 cursor buttons, paint and shift.

A blinking character shows the current location of the painting cursor.
The current brush character is shown in the top-left corner of the screen.

The cursor buttons move the cursor around the screen.
The paint button paints the current brush character at the cursor.
shift and paint buttons together paint a blank character at the cursor.
shift and up selects the next brush character.
shift and down selects the previous brush character.

Loading/Saving of the resulting image to non-volatile storage (e.g. SD card) has been left as an exercise for the reader ;o)

Required: A transmit-capable TellyMate shield, 6 push-buttons

Title Version Date File Size
Batsocks Paint 2.0 2012-02-18  tms_paint_002.ino 8.3 kB
Batsocks Paint 1.0 2009-06-08  tms_paint_001.pde 8.0 kB

Maze

Maze

Note: This game will switch into demonstration mode after about 10 seconds of no user input, so this sketch can be used as a demo, even if no buttons are attached.

This game allows a player to explore a maze, collecting money as they go. The buttons control the player movement and the brightness of the torch. If the player steps on the stairs, they move on to the next level.

The monster follows a simple right-hand rule when moving around the maze. It will steal gold from the player if he manages to walk into them (but he moves 4 times slower than the player, so the chances of this happening are slim!).

The maze is initially drawn to the screen using two different blank characters (32 and 255) - one for the walls and one for the floors.
As the player moves around the maze, an area around the player is 'read' from the tellymate, and then new values are written back, depending on wether that character was floor or wall, and depending on the brightness of the players lamp. A dimmer lamp returns the maze to darkness after the player has passed. A brighter lamp leaves a 'trail' of lit walls behind.

When the player is being 'auto' moved, it follows a left-hand rule.

Required: A transmit-capable TellyMate shield.
Optional: 6 push-buttons

Title Version Date File Size
Maze 2.0 2012-02-18  tms_maze_002.ino 24.6 kB
Maze 1.0 2009-07-09  tms_maze_001.pde 25.2 kB

Lavawave

This example simply uses whole and half-block characters to draw a sequence of simple -ve/+ve bar graphs. It uses a simple 'delta compression' method (a fancy way of saying "only draw what's changed") to speedup the framerate. Delta compression means a smooth 20fps is possible (compared to the 6fps that is normally possible).

Required: A TellyMate

Title Version Date File Size
Lavawave 2.0 2012-02-18  tms_lavawave_002.ino 6.7 kB
Lavawave 1.0 2011-03-04  tms_lavawave_001.pde 6.6 kB

Program Fontbank

A Font Character

This sketch allows you to reprogram the fontbank(s) that your TellyMate uses.

Either design your own font (using the Batsocks Font Designer spreadsheet) or use a fontbank that we've already designed.

There's currently a choice of...

Simply copy the data into the sketch (instructions are in the code) and upload the sketch to your Arduino. The Arduino will then program the TellyMate to use that set of fontbank data.

For more details about fontbanks, see the 'Fontbanks' section of the User Guide

Required: Firmware version 1.0.14 or later.

Title Version Date File Size
Program Fontbank 2.0 2012-02-18  tms_program_fontbank_002.ino 14.6 kB
Program Fontbank 1.0 2009-09-04  tms_program_fontbank_001.pde 14.6 kB
Fontbank data - Code Page 437 1.0 2009-09-04 (.c file) fontbank0.c 11.1 kB
Fontbank data - Pixel Patterns 1.0 2009-09-04 (.c file) fontbank1.c 11.0 kB
Fontbank data - Games 1.0 2009-09-04 (.c file) fontbank2.c 11.2 kB
Fontbank data - GUI 1.0 2009-09-04 (.c file) fontbank3.c 11.1 kB

Scribble

This is a demonstration of simple pixel drawing.

It uses special graphics characters to show 76x75 pixels on the 38x25 character screen. These graphics characters each hold 6 pixels (in a 2x3 grid). 64 graphics characters provide every combination of these 6 pixels. They are included in the 'Pixel Patterns' fontbank.

To set/clear a single pixel on the screen, the underlying character at that position is read and decoded. The correct graphics character to use is then calculated (to include the new pixel) and written back to the TellyMate.

At 57k6, around 720 pixels per second can be plotted.

In the example, simple trig functions are used to trace a line. At each iteration, a single pixel is plotted at the head, and a single pixel is cleared at the tail.

Required: a transmit-capable TellyMate with the 'Pixel Patterns' fontbank.

Note: For details on how to program a fontbank, see the 'Fontbank' section of the User Guide or the program fontbank sketch above.

Title Version Date File Size
Scribble 2.0 2012-02-18  tms_scribble_002.ino 6.3 kB
Scribble 1.0 2009-09-20  tms_scribble_001.pde 6.1 kB

Life

This is a version of Conway's game of life that demonstrates buffered pixel drawing. The world is torroidal - the left and right sides of the screen are "joined", as is the top and bottom.

A pixel buffer on the Arduino is used to hold the current generation of life. After each generation, the pixel buffer is drawn onto the TellyMate's screen using 2x3 pixelled graphics characters (as described in the Scribble example).

At 57k6, it's capable of redrawing the whole pixel buffer to the TellyMate around 6 times per second.

Required: a TellyMate with the 'Pixel Patterns' fontbank programmed.

Title Version Date File Size
Life 2.0 2012-02-18  tms_life_002.ino 9.5 kB
Life 1.0 2009-09-20  tms_life_001.pde 9.8 kB

Snakeduino

Michael Fuller's implementation of the classic snake game. If you've got no pushbuttons handy to play the game yourself, it will automatically switch into demo mode.

Eat the food.
Avoid everything else!

Required: A transmit-capable TellyMate shield.
Optional: 4 push-buttons

Michael has a Snakeduino page where you can download the sourcecode (It's very cleanly written and nicely commented - I wish all my code were this legible!).

Read Font

Read Font

This sketch demonstrates reading font data from the TellyMate. Every character of every fontbank on the TellyMate is shown.

Required: a transmit-capable TellyMate with firmware 1.1.00 (or above).

Title Version Date File Size
ReadFont 2.0 2012-08-12  tms_readfont_002.ino 5.3 kB
ReadFont 1.0 2010-03-09  tms_readfont_001.pde 5.0 kB

Arduino : Portal - Still Alive

you broke my heart

This sketch demonstrates vector graphics rendered as text, and some rudimentary music.
If you've not got a TellyMate, commenting out the #USE_TELLYMATE line in the sketch will produce serial data that's suitable for the Arduino IDE's serial monitor.

NEW! Now sports fancy two-channel wavetable based audio [now on pin 11].

Optional: a TellyMate.
Optional: a speaker (pin 11).

Title Version Date File Size
Arduino : Portal - Still Alive 3.0 2012-02-21  tms_StillAlive_003.ino 105.7 kB
Arduino : Portal - Still Alive 2.0 2010-11-21  tms_StillAlive_002.pde 105.4 kB
Arduino : Portal - Still Alive 1.0 2010-10-26  tms_StillAlive_001.pde 59.3 kB