// ARDUINO GB PRINTER (BY O.N.)
#include <avr/pgmspace.h>
#include <GBPrinter.h>
GBPrinter printer;
String readString;
boolean line = false;
void setup(){
printer.attach(8,9,10);
Serial.begin(9600);
}
void loop() {
//expect a string like wer,qwe rty,123 456,hyre kjhg,
//or like hello world,who are you?,bye!,
while (Serial.available()) {
delay(6);
char c = Serial.read(); //gets one byte from serial buffer
readString += c;
} //makes the string readString
if (readString.length()>9) {
Serial.print("Printing: ");
readString.toUpperCase();
Serial.println(readString); //prints string to serial port out
char yte[readString.length() + 1];
readString.toCharArray(yte, readString.length() + 1);
gbprintln(yte);
readString=""; //clears variable for new input
}
}
void gbprint(char* textt){
if(printer.init()){
printer.text(textt,GBPrinterFontsRegular, false);
printer.band(NULL, false);
printer.print(GBPrinter::defaultPrintProperties());
printer.wait();
}
}
void gbprintln(char* textt){
if(printer.init()){
printer.text(textt,GBPrinterFontsRegular, false);
printer.text(" ",GBPrinterFontsRegular, false);
printer.band(NULL, false);
printer.print(GBPrinter::defaultPrintProperties());
printer.wait();
}
}