Skip to content

Instantly share code, notes, and snippets.

@uniphil
Last active December 16, 2018 19:54
Show Gist options
  • Save uniphil/636f667d9a2e73f347a1c869cced5ab9 to your computer and use it in GitHub Desktop.
Save uniphil/636f667d9a2e73f347a1c869cced5ab9 to your computer and use it in GitHub Desktop.
arduino thermal printer settings
// copy this near the top of your sketch!
// change the numbers here to change print settings
// look at your parts kit receipt for numbers that work well with your printer
#define DOTS 4
#define HEAT_TIME 127
#define HEAT_INTERVAL 64
#define PRINT_DENSITY 1
#define PRINT_TIMEOUT 3
// copy this into your setup() function, after Thermal.begin(BAUD);
// set the print speed and heat
Thermal.write(27); // ASCII ESC (tell the printer we're sending a command)
Thermal.write(55); // print settings command! (next 3 bytes are settings)
Thermal.write(DOTS); // default 64 = 8*('7'+1)
Thermal.write(HEAT_TIME); // default 80 or 800us
Thermal.write(HEAT_INTERVAL); // default 2 or 20us
// set the print density and timeout
Thermal.write(18); // ASCII DC2 (data control 2 -- printer-defined)
Thermal.write(35); // more settings command! (next byte is settings)
Thermal.write((byte)((PRINT_DENSITY<<5) | PRINT_TIMEOUT));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment