Back to Parent

#include "Adafruit_Thermal.h"
#include "house6.h"

// #include "SoftwareSerial.h"
#define RXD2 9
#define TXD2 10

Adafruit_Thermal printer(&Serial1);      // Or Serial2, Serial3, etc.


void setup() {
    // pinMode(7, OUTPUT); digitalWrite(7, LOW);

  // put your setup code here, to run once:
  Serial1.begin(9600, SERIAL_8N1, 17, 16);

  // Serial1.begin(9600); // Use this instead if using hardware serial
  Serial.begin(9600);
  Serial.println("Initialize");
  
  printer.begin();
  printer.feed(1);        // Init printer (same regardless of serial type)
 // Font options

  printer.setFont('B');
  printer.justify('L');

//ENTER NAME
  printer.println("DEAREST DELAYNIE,");

  printer.setLineHeight(20);
  printer.println("");
  printer.setLineHeight();
  printer.justify('C');
  // printer.inverseOn();
  // printer.println("FontB");
  printer.println("Like finding a crumpled receipt in your winter coat on the morning of the years first snow, I have snuck into your belongings to remind you of something you forgot was ever there. ");
  printer.setLineHeight(50);
  printer.println("");

  printer.setLineHeight();
  printer.setFont('A');
  // printer.println("FontA (default)");
  printer.doubleHeightOn();
  printer.println("We hope you enjoyed your visit");
  printer.println("to our Haunted Smart Home on");
  printer.underlineOn();
  //DATE AND TIME
  printer.print("May 3, 2023 at 2:56 P.M.");
  printer.underlineOff();
  printer.println("");
  printer.println("Care to remember more?");
  printer.doubleHeightOff();
  
  // printer.setLineHeight(50);
  printer.println("");

  printer.printBitmap(house6_width, house6_height, house6_data);

  // printer.setLineHeight();
  // printer.justify('L');  
  // printer.print("You spent ");
  // printer.underlineOn();
  // printer.print("142 seconds ");
  // printer.underlineOff();
  // printer.print("staring at the ");
  // printer.underlineOn();
  // printer.print("left kitchen wall.");
  // printer.underlineOff();
  // printer.print(" Thats more than ");
  // printer.underlineOn();
  // printer.print("73%");
  // printer.underlineOff();
  // // printer.boldOn();
  // // printer.print("73%");
  // // printer.boldOff();
  // printer.print(" of visitors!");

  // printer.println("");
  // printer.setLineHeight(50);
  // printer.println("");
  // printer.setLineHeight();

  // printer.println("The room you spent the most time in was the ");
  // printer.underlineOn();
  // printer.print("bathroom.");
  // printer.underlineOff();
  // printer.print(" How much water did you have to drink?");
  // printer.setLineHeight(10);
  // printer.println("");
  // printer.setLineHeight();

  // printer.justify('C');
  // printer.setLineHeight(100);
  // printer.println("");
  // printer.setLineHeight();
  // printer.println("To further revisit the experience, check out the full visitor guestbook here: ");

  // printer.println("");
  // printer.justify('R');
  printer.println("tinyurl.com/rmehh");

  printer.println("Best,");
  printer.println("RME");
  
  printer.feed(4);
  // // // Test inverse on & off
  // // printer.inverseOn();
  // // printer.println(F("Inverse ON"));
  // // printer.inverseOff();

  // // // Test character double-height on & off
  // // printer.doubleHeightOn();
  // // printer.println(F("Double Height ON"));
  // // printer.doubleHeightOff();

  // // // Set text justification (right, center, left) -- accepts 'L', 'C', 'R'
  // // printer.justify('R');
  // // printer.println(F("Right justified"));
  // // printer.justify('C');
  // // printer.println(F("Center justified"));
  // // printer.justify('L');
  // // printer.println(F("Left justified"));

  // // // Test more styles
  // // printer.boldOn();
  // // printer.println(F("Bold text"));
  // // printer.boldOff();

  // // printer.underlineOn();
  // // printer.println(F("Underlined text"));
  // // printer.underlineOff();

  // // printer.setSize('L');        // Set type size, accepts 'S', 'M', 'L'
  // // printer.println(F("Large"));
  // // printer.setSize('M');
  // // printer.println(F("Medium"));
  // // printer.setSize('S');
  // // printer.println(F("Small"));

  // // printer.justify('C');
  // // printer.println(F("normal\nline\nspacing"));
  // // printer.setLineHeight(50);
  // // printer.println(F("Taller\nline\nspacing"));
  // // printer.setLineHeight(); // Reset to default
  // // printer.justify('L');
  
  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
}

void loop() {
  // put your main code here, to run repeatedly:

}
Click to Expand

Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0