Skip to content

Instantly share code, notes, and snippets.

@simonjgreen
Created April 1, 2014 19:33
Show Gist options
  • Save simonjgreen/9921372 to your computer and use it in GitHub Desktop.
Save simonjgreen/9921372 to your computer and use it in GitHub Desktop.
Arduino printer quick ref
// Test inverse on & off
printer.inverseOn();
printer.println("Inverse ON");
printer.inverseOff();
// Test character double-height on & off
printer.doubleHeightOn();
printer.println("Double Height ON");
printer.doubleHeightOff();
// Set text justification (right, center, left) -- accepts 'L', 'C', 'R'
printer.justify('R');
printer.println("Right justified");
printer.justify('C');
printer.println("Center justified");
printer.justify('L');
printer.println("Left justified");
// Test more styles
printer.boldOn();
printer.println("Bold text");
printer.boldOff();
printer.underlineOn();
printer.println("Underlined text ");
printer.underlineOff();
printer.setSize('L'); // Set type size, accepts 'S', 'M', 'L'
printer.println("Large"); // Print line
printer.setSize('M');
printer.println("Medium");
printer.setSize('S');
printer.println("Small");
printer.justify('C');
printer.println("normal\nline\nspacing");
printer.setLineHeight(50);
printer.println("Taller\nline\nspacing");
printer.setLineHeight(); // Reset to default
printer.justify('L');
// Barcode examples
printer.feed(1);
// CODE39 is the most common alphanumeric barcode
printer.printBarcode("ADAFRUT", CODE39);
printer.setBarcodeHeight(100);
// Print UPC line on product barcodes
printer.printBarcode("123456789123", UPC_A);
// Print the 75x75 pixel logo in adalogo.h
printer.printBitmap(adalogo_width, adalogo_height, adalogo_data);
// Print the 135x135 pixel QR code in adaqrcode.h
printer.printBitmap(adaqrcode_width, adaqrcode_height, adaqrcode_data);
printer.println("Adafruit!");
printer.feed(1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment