The Star-Spangled Banner with Thermal Printer
#include "Adafruit_Thermal.h"
#include "adalogo.h"
#include "adaqrcode.h"
#include "adalogo.h"
#include "adaqrcode.h"
#include "SoftwareSerial.h"
#define TX_PIN 6 // Arduino transmit YELLOW WIRE labeled RX on printer
#define RX_PIN 5 // Arduino receive GREEN WIRE labeled TX on printer
#define TX_PIN 6 // Arduino transmit YELLOW WIRE labeled RX on printer
#define RX_PIN 5 // Arduino receive GREEN WIRE labeled TX on printer
SoftwareSerial mySerial(RX_PIN, TX_PIN); // Declare SoftwareSerial obj first
Adafruit_Thermal printer(&mySerial); // Pass addr to printer constructor
Adafruit_Thermal printer(&mySerial); // Pass addr to printer constructor
// -----------------------------------------------------------------------
void setup() {
pinMode(7, OUTPUT); digitalWrite(7, LOW);
// NOTE: SOME PRINTERS NEED 9600 BAUD instead of 19200, check test page.
mySerial.begin(19200); // Initialize SoftwareSerial
//Serial1.begin(19200); // Use this instead if using hardware serial
printer.begin(); // Init printer (same regardless of serial type)
mySerial.begin(19200); // Initialize SoftwareSerial
//Serial1.begin(19200); // Use this instead if using hardware serial
printer.begin(); // Init printer (same regardless of serial type)
printer.justify('C');
printer.setLineHeight(24);
//printer.doubleHeightOn();
//printer.inverseOn();
printer.underlineOn();
//Music Note Text
//531351^
printer.doubleHeightOn();
printer.println(F("||||||||||||||||||||"));//13 /5
printer.doubleHeightOff();
printer.println(F("||||||||||||||||||||||||"));//9 /3
printer.println(F("||||||||||||||||||||||||||||"));//5 /1
printer.println(F("||||||||||||||||||||||||"));//9 /3
printer.println(F("||||||||||||||||||||"));//13 /5
printer.doubleHeightOn();
printer.println(F("||||||||||||||"));//19 /1^
printer.doubleHeightOff();
printer.doubleHeightOn();
printer.println(F("||||||||||||||||||||"));//13 /5
printer.doubleHeightOff();
printer.println(F("||||||||||||||||||||||||"));//9 /3
printer.println(F("||||||||||||||||||||||||||||"));//5 /1
printer.println(F("||||||||||||||||||||||||"));//9 /3
printer.println(F("||||||||||||||||||||"));//13 /5
printer.doubleHeightOn();
printer.println(F("||||||||||||||"));//19 /1^
printer.doubleHeightOff();
//3^2^1^345-
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||||||"));//21 /2^
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||||||||||||||"));//9 /3
printer.println(F("||||||||||||||||||||||"));//11 /4
printer.doubleHeightOn();
printer.println(F("||||||||||||||||||||"));//13 /5
printer.doubleHeightOff();
//553^2^1^ 7-671^1^531
printer.println(F("||||||||||||||||||||"));//13 /5
printer.println(F("||||||||||||||||||||"));//13 /5
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||||||"));//21 /2^
printer.println(F("||||||||||||||"));//19 /1^
printer.doubleHeightOn();
printer.println(F("||||||||||||||||"));//17 /7
printer.doubleHeightOff();
printer.println(F("||||||||||||||||||"));//15 /6
printer.println(F("||||||||||||||||"));//17 /7
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||||||||||"));//13 /5
printer.println(F("||||||||||||||||||||||||"));//9 /3
printer.doubleHeightOn();
printer.println(F("||||||||||||||||||||||||||||"));//5 /1
printer.doubleHeightOff();
printer.println(F("||||||||||||||||||||"));//13 /5
printer.println(F("||||||||||||||||||||"));//13 /5
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||||||"));//21 /2^
printer.println(F("||||||||||||||"));//19 /1^
printer.doubleHeightOn();
printer.println(F("||||||||||||||||"));//17 /7
printer.doubleHeightOff();
printer.println(F("||||||||||||||||||"));//15 /6
printer.println(F("||||||||||||||||"));//17 /7
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||||||||||"));//13 /5
printer.println(F("||||||||||||||||||||||||"));//9 /3
printer.doubleHeightOn();
printer.println(F("||||||||||||||||||||||||||||"));//5 /1
printer.doubleHeightOff();
//531351^-
printer.println(F("||||||||||||||||||||"));//13 /5
printer.println(F("||||||||||||||||||||||||"));//9 /3
printer.println(F("||||||||||||||||||||||||||||"));//5 /1
printer.println(F("||||||||||||||||||||||||"));//9 /3
printer.println(F("||||||||||||||||||||"));//13 /5
printer.doubleHeightOn();
printer.println(F("||||||||||||||"));//19 /1^
printer.doubleHeightOff();
printer.println(F("||||||||||||||||||||"));//13 /5
printer.println(F("||||||||||||||||||||||||"));//9 /3
printer.println(F("||||||||||||||||||||||||||||"));//5 /1
printer.println(F("||||||||||||||||||||||||"));//9 /3
printer.println(F("||||||||||||||||||||"));//13 /5
printer.doubleHeightOn();
printer.println(F("||||||||||||||"));//19 /1^
printer.doubleHeightOff();
//3^2^1^345-
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||||||"));//21 /2^
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||||||||||||||"));//9 /3
printer.println(F("||||||||||||||||||||||"));//11 /4
printer.doubleHeightOn();
printer.println(F("||||||||||||||||||||"));//13 /5
printer.doubleHeightOff();
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||||||"));//21 /2^
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||||||||||||||"));//9 /3
printer.println(F("||||||||||||||||||||||"));//11 /4
printer.doubleHeightOn();
printer.println(F("||||||||||||||||||||"));//13 /5
printer.doubleHeightOff();
//553^2^1^ 7-671^1^531
printer.println(F("||||||||||||||||||||"));//13 /5
printer.println(F("||||||||||||||||||||"));//13 /5
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||||||"));//21 /2^
printer.println(F("||||||||||||||"));//19 /1^
printer.doubleHeightOn();
printer.println(F("||||||||||||||||"));//17 /7
printer.doubleHeightOff();
printer.println(F("||||||||||||||||||"));//15 /6
printer.println(F("||||||||||||||||"));//17 /7
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||||||||||"));//13 /5
printer.println(F("||||||||||||||||||||||||"));//9 /3
printer.doubleHeightOn();
printer.println(F("||||||||||||||||||||||||||||"));//5 /1
printer.doubleHeightOff();
printer.println(F("||||||||||||||||||||"));//13 /5
printer.println(F("||||||||||||||||||||"));//13 /5
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||||||"));//21 /2^
printer.println(F("||||||||||||||"));//19 /1^
printer.doubleHeightOn();
printer.println(F("||||||||||||||||"));//17 /7
printer.doubleHeightOff();
printer.println(F("||||||||||||||||||"));//15 /6
printer.println(F("||||||||||||||||"));//17 /7
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||||||||||"));//13 /5
printer.println(F("||||||||||||||||||||||||"));//9 /3
printer.doubleHeightOn();
printer.println(F("||||||||||||||||||||||||||||"));//5 /1
printer.doubleHeightOff();
//3^3^3^4^5^5^-
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||"));//25 /4^
printer.println(F("||||||"));//27 /5^
printer.println(F("||||||"));//27 /5^
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||"));//25 /4^
printer.println(F("||||||"));//27 /5^
printer.println(F("||||||"));//27 /5^
//4^3^2^3^4^4^-
printer.println(F("||||||||"));//25 /4^
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||||||"));//21 /2^
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||"));//25 /4^
printer.doubleHeightOn();
printer.println(F("||||||||"));//25 /4^
printer.doubleHeightOff();
printer.println(F("||||||||"));//25 /4^
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||||||"));//21 /2^
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||"));//25 /4^
printer.doubleHeightOn();
printer.println(F("||||||||"));//25 /4^
printer.doubleHeightOff();
//4^4^3^2^1^ 77671^345-
printer.println(F("||||||||"));//25 /4^
printer.println(F("||||||||"));//25 /4^
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||||||"));//21 /2^
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||"));//25 /4^
printer.println(F("||||||||"));//25 /4^
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||||||"));//21 /2^
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||||||"));//17 /7
printer.println(F("||||||||||||||||"));//17 /7
printer.println(F("||||||||||||||||||"));//15 /6
printer.println(F("||||||||||||||||"));//17 /7
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||||||||||||||"));//9 /3
printer.println(F("||||||||||||||||||||||"));//11 /4
printer.doubleHeightOn();
printer.println(F("||||||||||||||||||||"));//13 /5
printer.doubleHeightOff();
printer.println(F("||||||||||||||||"));//17 /7
printer.println(F("||||||||||||||||||"));//15 /6
printer.println(F("||||||||||||||||"));//17 /7
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||||||||||||||"));//9 /3
printer.println(F("||||||||||||||||||||||"));//11 /4
printer.doubleHeightOn();
printer.println(F("||||||||||||||||||||"));//13 /5
printer.doubleHeightOff();
//551^1^1^7666 2^4^3^2^1^1^7^ 551^2^3^4^5^-
printer.println(F("||||||||||||||||||||"));//13 /5
printer.println(F("||||||||||||||||||||"));//13 /5
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||||||"));//17 /7
printer.println(F("||||||||||||||||||"));//15 /6
printer.println(F("||||||||||||||||||"));//15 /6
printer.println(F("||||||||||||||||||"));//15 /6
printer.println(F("||||||||||||||||||||"));//13 /5
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||||||"));//17 /7
printer.println(F("||||||||||||||||||"));//15 /6
printer.println(F("||||||||||||||||||"));//15 /6
printer.println(F("||||||||||||||||||"));//15 /6
printer.println(F("||||||||||||"));//21 /2^
printer.println(F("||||||||"));//25 /4^
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||||||"));//21 /2^
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||"));//31 /7^
printer.println(F("||||||||"));//25 /4^
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||||||"));//21 /2^
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||"));//31 /7^
printer.println(F("||||||||||||||||||||"));//13 /5
printer.println(F("||||||||||||||||||||"));//13 /5
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||"));//21 /2^
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||"));//25 /4^
printer.doubleHeightOn();
printer.println(F("||||||"));//27 /5^
printer.doubleHeightOff();
printer.println(F("||||||||||||||||||||"));//13 /5
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||"));//21 /2^
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||"));//25 /4^
printer.doubleHeightOn();
printer.println(F("||||||"));//27 /5^
printer.doubleHeightOff();
//1^2^3^4^2^1^--
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||"));//21 /2^
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||"));//25 /4^
printer.println(F("||||||||||||"));//21 /2^
printer.doubleHeightOn();
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||||"));//19 /1^
printer.doubleHeightOff();
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||"));//21 /2^
printer.println(F("||||||||||"));//23 /3^
printer.println(F("||||||||"));//25 /4^
printer.println(F("||||||||||||"));//21 /2^
printer.doubleHeightOn();
printer.println(F("||||||||||||||"));//19 /1^
printer.println(F("||||||||||||||"));//19 /1^
printer.doubleHeightOff();
printer.feed(2);
printer.sleep(); // Tell printer to sleep
delay(3000L); // Sleep for 3 seconds
printer.wake(); // MUST wake() before printing again, even if reset
printer.setDefault(); // Restore printer to defaults
}
delay(3000L); // Sleep for 3 seconds
printer.wake(); // MUST wake() before printing again, even if reset
printer.setDefault(); // Restore printer to defaults
}
void loop() {
}
}