I've a big problem with Mini Thermal Receipt Printer.
I compiled this program:
- Code: Select all
#include <LiquidCrystal.h>
#include "SoftwareSerial.h"
#include "Adafruit_Thermal.h"
int printer_RX_Pin = 8; // this is the green wire
int printer_TX_Pin = 9; // this is the yellow wire
Adafruit_Thermal printer(printer_RX_Pin, printer_TX_Pin);
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
void setup() {
lcd.begin(20,4);
Serial.begin(1200);
printer.begin();
}
void loop() {
if (Serial.available()) {
char inByte = Serial.read();
switch (inByte) {
case '\n':
lcd.setCursor(0,0);
//printer.println();
break;
case 'L':
lcd.setCursor(0,1);
lcd.write("L");
//printer.println();
//printer.print("L");
break;
case 'H':
lcd.setCursor(0,2);
lcd.write("H");
//printer.println();
//printer.print("H");
break;
case '\r':
break;
default:
Serial.write(inByte);
lcd.write(inByte);
printer.write(inByte);
}
}
}
It works for few seconds after that it starts to print (both on LCD and printer) strange things.
If I delet last row (printer.write(inByte);) everything works fine.
Without that row this is what I see on serial monitor:
kT1 23.5 Hi 24.6 Lo 22.6
kT1 23.5 Hi 24.6 Lo 22.6
kT1 23.4 Hi 24.6 Lo 22.6
kT1 23.5 Hi 24.6 Lo 22.6
When I use that row this is what I see on my serial monitor (see attached image) and this is what I see on LCD:
kT1 266C
Lo .266 ..
i 26. 5
I use Arduino UNO with 1.0 IDE.
How can I solve it? I've also tried to put printer.write(); in other points of the sketch, but no way. Thank to anyone who can help me,
Alberto

