A Library to control an ESC/POS printer by an ARDUINO via serial connection.
To get Arduino work together with the thermal printer on RS232 (serial) you need a level shifter. From Maxim you can get MAX2XX chips for 5 Volt and MAX32XX for 3.3 volt powered arduinos. The library works with SoftSerial so you are still able to send Data to Arduino with the standard serial line. The SoftSerial works at 9600 baud.
- Epson TM-T88II (Serial RS232) & Arduino Uno & Maxim MAX233CPP
- Epson TM-T20 (Serial RS232) & Arduino Uno & Maxim MAX233CPP
The functions available in this class are:
Constructor that initializes the rxPin
and txPin
used to communicate with the printer and calls the start()
function.
Sets up the communication pins, initializes the SoftwareSerial
object used for communication with the printer, and sets the baud rate to 9600.
Reads a single byte of data from the printer.
Writes a single byte of data to the printer.
Sends a query to the printer to check its status. Returns 0
if the printer is online.
Prints the data in the print buffer and feeds n
lines of paper.
Equivalent to calling feed(1)
.
Sets the line spacing to n/180
inch.
Sets the line spacing to 1/6
inch, which is equivalent to 30 dots.
Sets the paper width to 80mm.
Sets the paper width to 58mm.
Selects an international character set based on the value of n
. See table below for more metails.
0 = U.S.A.
1 = France
2 = Germany
3 = U.K.
4 = Denmark I
5 = Sweden
6 = Italy
7 = Spain
8 = Japan
9 = Norway
10 = Denmark II
11 = Spain II
12 = Latin America
13 = Korea
14 = Slovenia / Croatia
15 = China
Enables double-height text printing. Can be combined with other effect.
Enables double-width text printing. Can be combined with other effect.
Enables bold text printing. Can be combined with other effect.
Enables underlined text printing. Can be combined with other effect.
Disables all text printing effect.
Enables white/black reverse printing mode.
Disables white/black reverse printing mode.
Sets text justification to left.
Sets text justification to center.
Sets text justification to right.
Sets the height of barcodes to 162 dots.
Sets the width of barcodes to 3 dots.
Sets the position of the barcode text. Range 0-3. 0=no 1=above 2=below 3=both
Prints a barcode. Use EscPos->print("barcode") to send the string of barcode.
End the barcode print.
Prints a qrcode. len
value is lenght in char of the string. Use EscPos->print("qrcode") to send the string of barcode.
End the qrcode print.
Performs a full cut of the paper.
Performs a partial cut of the paper.
You may use this work under the terms of either the MIT License or the GNU General Public License (GPL) Version 3
- 2023-05-08 - first public release
thermal, micro, receipt, printer, serial, tm-t88, tm88, tmt88, epson, arduino, tm20, tm-t20, tmt20