What I wanted to learn, and why it interested me: I wanted to learn how to use the thermal receipt printer because I thought it was super cool how past students have incorporated it into past projects.
Final outcome: As my final build I made a "choose your own adventure" story in which the user can choose a story outcome using 'A' and 'B' buttons.
Images of final creative/exploratory output
Friend embarking on limerick adventure.
Receipt with limerick adventure.
The limericks (I tried):
There once was a cat who loved ice cream.
This cat, one night, had a dream.
She woke up with a gasp,
Her blanket in grasp,
Impossible, she said, it seems!
What did she dream about?
A) A life in which she doesn’t like ice cream
B) A prophecy that a heat wave comes
A)
A life without ice cream is awful!
I don't even think that's lawful!
There's something I must do,
To make ice cream anew,
So that everyone here wants a spoonful.
What’s a better ice cream flavor?
A.1) Mint chocolate chip
B.1) Salted caramel
A.1)
The cat was super strong-willed!
This idea made her happy and thrilled!
She would open a shop
And she came out on top,
Selling ice cream, forever fulfilled.
B.1)
So the cat started to cook up some flavors.
She made infinite ice creams to savor.
Every day she would taste one,
Until a bad one gave her the runs,
Sadly ice cream was no longer in her favor.
B)
This cat was prophetic,
For the very next day, the heat hit,
It’s in the one hundreds,
But boy do I love it.
I can eat ice cream all day, will you believe it!
Ok so are you a cat person or a dog person?
A.2) Dog
B.2) Cat
A.2)
But it turned for the worst when she ordered a scoop,
When her beautiful mint chocolate all turned to gloop.
It turned into liquid and ran down her paws,
The sun was too hot, it made her feel blah.
The cat sat there sadly, drinking up soup.
B.2)
Every day she ate ice cream with delight,
She kept off the heat with each bite.
It was the best week,
But too much sugar is not for the weak,
She ended up with a toothache at night.
Process images from development towards creative/exploratory output
Not shown, but at this point, pressing A to restart did not work, and storyline B also did not work (pressing A after B would navigate to storyline A).
Process and reflection:
This process was a little bit daunting mentally because I wasn't sure where to start. The most tricky part was changing the function of the button to change each time the user navigated to a new scene in the story. For example, button A would take the user from scene 1 to 2, but then afterwards it might be used to navigate from scene 2 to scene 3.
In my first attempt, I tried to nestle "if" statements, hoping that the Arduino would move through the "nest" sequentially. That was not a thing. Then Chat taught me "else if" statements. I made storyA and storyB variables that I could add 1 to in each step of the story, so that I could then write "else if" statements that would correspond to a button press and a value of storyA and storyB. Although this kind of worked, it was a very unnecessarily confusing way to go about it. In testing it out, sometimes scenes would skip, or pressing a button would navigate to the wrong scene. Then Chat (and a tip from Joseph) advised me to think of it like a tree, where each scene was a different "state" or branch off the tree. This was helpful and helped me cut out things that made things confusing (like making ONE variable called storyState and actually assigning storyState to an integer each scene instead of doing all this weird add one stuff).
So there was a lot of trial and error per usual, but in the end, I am proud of writing something up that is for the most part, my own!
Technical details
Electrical schematic of thermal printer
/*
60-223 Intro to Physical Computing, Spring 2026
Domain-specific Skill Building exercise: Thermal Receipt Printer
Indie Lee
This sketch connects to a thermal receipt printer and two buttons.
The two buttons are coded so that pressing them allows the user to
navigate a choose your own adventure story that is then printed
via the thermal receipt printer.
Pin mapping:
Arduino pin | role | details
------------------------------
6 TX thermal printer
5 RX thermal printer
8 input button A
9 input button B
*/
#include "Adafruit_Thermal.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
SoftwareSerial mySerial(RX_PIN, TX_PIN); // Declare SoftwareSerial obj first
Adafruit_Thermal printer(&mySerial); // Pass addr to printer constructor
const int BUTTONPINA = 8;
const int BUTTONPINB = 9;
int storyState = 0;
int buttonValA, buttonValB;
void setup() {
// put your setup code here, to run once:
pinMode(7, OUTPUT); digitalWrite(7, LOW);
pinMode(BUTTONPINA, INPUT_PULLUP); //orange
pinMode(BUTTONPINB, INPUT_PULLUP); //green
mySerial.begin(9600);
printer.begin();
printer.wake();
printer.setFont('A'); //fontA
printer.setSize('S'); //size small
home();
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:
buttonValA = digitalRead(BUTTONPINA);
buttonValB = digitalRead(BUTTONPINB);
if (buttonValA == LOW && storyState == 0) {
story();
}
//Story A
else if (buttonValA == LOW && storyState == 1) {
storyA();
}
else if(buttonValA == LOW && storyState == 2) {
storyAA();
}
else if(buttonValB == LOW && storyState == 2) {
storyAB();
}
//Story B
else if(buttonValB == LOW && storyState == 1) {
storyB();
}
else if(buttonValA == LOW && storyState == 3) {
storyBA();
}
else if(buttonValB == LOW && storyState == 3) {
storyBB();
}
//restart
else if(buttonValA == LOW && storyState == 4){
home();
}
}
void home() {
printer.justify('C'); //center justified
printer.println(F("Hello!\nPress A to choose your own limerick adventure"));
printer.setLineHeight();
printer.feed(3);
printer.justify('L');
storyState = 0;
}
void story() {
printer.println(F("There once was a cat who loved ice cream\nThis cat, one night, had a dream.\nShe woke up with a gasp,\nHer blanket in grasp,\nImpossible, she said, it seems!\n"));
printer.println(F("\nWhat did she dream about?\nA) a life in which she doesn't like ice cream\nB) a prophecy that a heat wave comes"));
printer.feed(3);
storyState = 1;
}
void storyA() {
printer.println(F("A life without ice cream is awful!\nI don't even think that's lawful!\nThere's something I must do,\nTo make ice cream anew,\nSo that everyone here wants a spoonful.\n"));
printer.println(F("What's a better ice cream flavor?\nA) mint chocolate chip\nB) salted caramel"));
printer.feed(3);
storyState = 2;
}
void storyAA() {
printer.println(F("The cat was super strong-willed!\nThis idea made her happy and thrilled!\nShe would open a shop,\nAnd she came out on top,\nSelling ice cream, forever fulfilled.\n"));
printer.justify('C');
printer.println(F("The end.\nPress A to restart"));
printer.feed(3);
storyState = 4;
}
void storyAB() {
printer.println(F("So the cat started to cook up some flavors.\nShe made infinite ice creams to savor.\nEvery day she would taste one,\nUntil a bad one gave her the runs,\nSadly ice cream was no longer in her favor.\n"));
printer.justify('C');
printer.println(F("The end.\nPress A to restart"));
printer.feed(3);
storyState = 4;
}
void storyB() {
printer.println(F("This cat was prophetic,\nFor the very next day, the heat hit,\nIt's in the one hundreds,\nBut boy do I love it.\nI can eat ice cream all day, will you believe it!\n"));
printer.println(F("Ok so are you a cat person or a dog person?\nA) dog\nB) cat"));
printer.feed(3);
storyState = 3;
}
void storyBA() {
printer.println(F("But it turned for the worst when she ordered a scoop,\nWhen her beautiful mint chocolate all turned to gloop.\nIt turned into liquid and ran down her paws,\nThe sun was too hot, it made her feel blah.\nThe cat sat there sadly, drinking up soup.\n"));
printer.justify('C');
printer.println(F("The end.\nPress A to restart"));
printer.feed(3);
storyState = 4;
}
void storyBB() {
printer.println(F("Every day she ate ice cream with delight,\nShe kept off the heat with each bite.\nIt was the best week,\nBut too much sugar is not for the weak,\nShe ended up with a toothache at night.\n"));
printer.justify('C');
printer.println(F("The end.\nPress A to restart"));
printer.feed(3);
storyState = 4;
}