Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool buttonpressed = false;
- int button = 30;
- void setup() {
- //setup button on board
- pinMode(button, INPUT);
- Serial1.begin(19200); // Use this instead if using hardware serial
- //Print Settings-----------------
- //Modify the print speed and heat
- Serial1.write(27);
- Serial1.write(55);
- Serial1.write(7); //Default 64 dots = 8*('7'+1)
- Serial1.write(255); //Default 80 or 800us
- Serial1.write(255); //Default 2 or 20us
- //Modify the print density and timeout
- Serial1.write(18);
- Serial1.write(35);
- int printSetting = (15<<4) | 15;
- Serial1.write(printSetting); //Combination of printDensity and printBreakTime
- //-------------------------------
- }
- void Print()
- {
- //printed lines
- Serial1.println("Hello World!");
- Serial1.println("(0.o)");
- delay(3000L); // Sleep for 3 seconds
- }
- void loop()
- {
- if(digitalRead(button))
- {
- if(!buttonpressed){
- Print();
- buttonpressed = true;
- }
- } else {
- buttonpressed = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement