import processing.serial.*; Serial myPort; // The serial port static int LF = 10; // text to print String lines[] = { " ", "one potato", "two potato", "three potato", "four", " ", "five potato", "six potato", "seven potato", "or" }; // place marker variable int linesPos = 0; void setup() { // serial init println(Serial.list()); // I know that the first port in the serial list on my mac // is always my Keyspan adapter, so I open Serial.list()[0]. // Open whatever port is the one you're using. myPort = new Serial(this, Serial.list()[0], 4800); // graphics init size(200, 200); // //init receipt printer myPort.write(ESC); myPort.write("@"); // fast feed myPort.write(ESC); myPort.write('d'); myPort.write(8); // line feed myPort.write(LF); // cut paper myPort.write(ESC); myPort.write('i'); delay(1000); }; void draw() { // //change to color 1 myPort.write(ESC); myPort.write(114); myPort.write(1); // color 1 delay(1000); sendNextLine(); } void sendNextLine() { myPort.write(lines[linesPos]); myPort.write(LF); println(lines[linesPos]); linesPos++; if(linesPos >= lines.length) { linesPos = 0; // fast feed myPort.write(ESC); myPort.write('d'); myPort.write(8); // feed this many lines // cut paper myPort.write(ESC); myPort.write('i'); } //while(textBuff.length()