This code implements the project described in my blog post of converting a Brother typewriter into a teletype using an Arduino.
debounce.h
- simple, fast 2-bit debouncerkeycodes.h
- keyboard layout map in terms of scan and signal linesloremipsum.py
- userspace program for testing printing over serialsignals.h
- provides signal mappings for current board and functions for writing themsignals_duemilanove.h
- signal mappings for using the Arduino Duemilanove (and other Arduino-compliant boards based on the ATmega168 and ATmega328)signals_mega.h
- signal mappings for using the Arduino Mega (and other Arduino-compliant boards based on the ATmega1280)typewriter.pde
- core logic
People often find this project searching for how to use PROGMEM. There's not enough space in RAM for for the key lookup tables on the ATmega168, so PROGMEM is used in keycodes.h
to keep them in program memory. To access data that's in PROGMEM, typewriter.pde
uses pgm_read_word_near
(you can also use pgm_read_byte_near
) to read the data.
For more information about PROGMEM, see the Arduino Reference.
This code was finished in 2010 and hasn't been developed much since. At the time of publishing there were no known bugs, and the only feature missing was flow control (hence the timing delays in loremipsum.py
).
However, any project with external dependencies will break as the world turns, so it is not guaranteed to work. I haven't reflashed the typewriter in over a year, so at this point the code is academic.
The code in debouncer.h
was originally provided by Ben Holt. My modifications were mostly superficial in nature, though I did add a few optimizations.
The more tricky debugging (like diagnosing the RAM overflow bug that necessitated using PROGMEM on the ATmega168) was assisted by Micah Scott.
Thanks to Cindy for putting up with me when I ignored everything except my desk for a few days. Again.