#include "Adafruit_Thermal.h" #include "SoftwareSerial.h" const int TX_PIN = 6; const int RX_PIN = 5; const int buttonBigRedPin = 7; const int switchOnePin = 8; const int switchTwoPin = 12; const int switchThreePin = 13; int buttonBigRedState = 0; int switchOneState = 0; int switchTwoState = 0; int switchThreeState = 0; String oddlysatisfyingInfo = ( " " " --- r/oddlysatisfying --- " " " " Some people may call you odd, " " or even think you're fluky. " " Nonetheless, you bring your own" " unusual charm and joy to the " " lives of many. " " " " --- 8 Bits and a Byte --- " " " ); String DIYInfo = ( " " " --- r/DIY --- " " " " Independent and resourceful. " " You are able to bring to life " " even the most ambitious ideas." " " " --- 8 Bits and a Byte --- " " " ); String awwInfo = ( " " " --- r/aww --- " " " "Irresistible to almost everybody" " you are the true embodiment of " " all good in this world. " " " " --- 8 Bits and a Byte --- " " " ); String todayilearnedInfo = ( " " " --- r/todayilearned --- " " " " You have an insatiable thirst " " for knowledge. " " This means you are capable of " " providing an endless stream of " " fun fact and true oddities. " " " " --- 8 Bits and a Byte --- " ); String funnyInfo = ( " " " --- r/funny --- " " " " Whenever there is fun you're " " always near. " "Your sense of humor is unmatched" "and brings comic relief to many." " " " --- 8 Bits and a Byte --- " " " ); String gamingInfo = ( " " " --- r/gaming --- " " " " A true adventurer, " "you have traveled many different" " worlds and have lived through " " countless stories. " " " " --- 8 Bits and a Byte --- " " " ); String worldnewsInfo = ( " " " --- r/worldnews --- " " " " Always in the know-how and " " up-to-date, " " your unique ability makes you " "the cornerstone of this society." " " " --- 8 Bits and a Byte --- " " " ); String artInfo = ( " " " --- r/art --- " " " " With a distinctive personality " " and the skill set to match, " " you have the power to create " " beauty and to speak " " without talking. " " " " --- 8 Bits and a Byte --- " " " ); SoftwareSerial mySerial(RX_PIN, TX_PIN); Adafruit_Thermal printer(&mySerial); void setup() { mySerial.begin(19200); pinMode(7, OUTPUT); digitalWrite(7, LOW); printer.begin(); printer.justify('C'); pinMode(buttonBigRedPin, INPUT); pinMode(switchOnePin, INPUT); pinMode(switchTwoPin, INPUT); pinMode(switchThreePin, INPUT); digitalWrite(buttonBigRedPin, HIGH); digitalWrite(switchOnePin, HIGH); digitalWrite(switchTwoPin, HIGH); digitalWrite(switchThreePin, HIGH); } void printSubreddit(String subreddit){ printer.print(subreddit); } void printBorder(){ String border = "********************************"; printer.print(border); } void loop() { // read the state of the pushbutton value: buttonBigRedState = digitalRead(buttonBigRedPin); // check if the pushbutton is pressed. If it is, the buttonState is LOW: if (buttonBigRedState == LOW) { switchOneState = digitalRead(switchOnePin); switchTwoState = digitalRead(switchTwoPin); switchThreeState = digitalRead(switchThreePin); printBorder(); // Print the correct answer based on all three switch states if(switchOneState && switchTwoState && switchThreeState){ printSubreddit(oddlysatisfyingInfo); }else if(switchOneState && switchTwoState && !switchThreeState){ printSubreddit(DIYInfo); } else if(switchOneState && !switchTwoState && switchThreeState){ printSubreddit(awwInfo); } else if(switchOneState && !switchTwoState && !switchThreeState){ printSubreddit(todayilearnedInfo); } else if(!switchOneState && !switchTwoState && !switchThreeState){ printSubreddit(funnyInfo); } else if(!switchOneState && !switchTwoState && switchThreeState){ printSubreddit(gamingInfo); } else if(!switchOneState && switchTwoState && !switchThreeState){ printSubreddit(worldnewsInfo); } else if(!switchOneState && switchTwoState && switchThreeState){ printSubreddit(artInfo); } printBorder(); printer.println("\n\n\n"); } delay(500); }