I want to attach my GOOJPRT Thermal Printer (I believe model QR701, communication RS232) to my ESP32 but I cannot seem to get them working.
I tried all the Adafruit Thermal Printer library examples but get the same error each and every time:
"Error compiling for board ESP32 Dev Module."
I guess the libraries are not meant for the ESP32. I also tried the "Thermal Printer Library" by Larry Bank (which should be compatible with the ESP32 according to its github docs) but there I cannot figure out how to connect the wires of thermal printer to the ESP32 correctly.
Of course, I do not ask for a specific solution, I am just looking for someone to point me in the right direction!
This is an image of the exact thermal printer I have
Full error message from Adafruit Thermal Printer examples:
C:\Users\Thomas\Documents\Arduino\libraries\SoftwareSerial-master\SoftwareSerial.cpp:41:27: fatal error: avr/interrupt.h: No such file or directory
compilation terminated.
Multiple libraries were found for "Adafruit_Thermal.h"
Used: C:\Users\Thomas\Documents\Arduino\libraries\Adafruit_Thermal_Printer_Library
Not used: C:\Users\Thomas\Documents\Arduino\libraries\Adafruit-Thermal-Printer-Library-master
Multiple libraries were found for "SoftwareSerial.h"
Used: C:\Users\Thomas\Documents\Arduino\libraries\SoftwareSerial-master
Not used: C:\Users\Thomas\Documents\Arduino\libraries\EspSoftwareSerial
exit status 1
Error compiling for board ESP32 Dev Module
Second error message from Adafruit Thermal Printer example after removing the manually installed SoftwareSerial.h:
A_printertest:21:28: fatal error: SoftwareSerial.h: No such file or directory
Multiple libraries were found for "Adafruit_Thermal.h"
compilation terminated.
Used: C:\Users\Thomas\Documents\Arduino\libraries\Adafruit_Thermal_Printer_Library
Not used: C:\Users\Thomas\Documents\Arduino\libraries\Adafruit-Thermal-Printer-Library-master
exit status 1
SoftwareSerial.h: No such file or directory
-
1What is the error you are actually getting? The message you pasted us is the one telling you that an error occurred, not what the error was. Without the actual error we can't help you.Majenko– Majenko2021年01月14日 11:15:01 +00:00Commented Jan 14, 2021 at 11:15
-
@Majenko♦ Please see the full error message above, which I copy pasted from the Arduino IDEThomas– Thomas2021年01月14日 13:22:41 +00:00Commented Jan 14, 2021 at 13:22
-
It looks like you have installed some other SoftwareSerial library manually. You should never ever need to do that since almost all cores bundle their own version that is specific to the core. Delete it. You don't want it. Ever.Majenko– Majenko2021年01月14日 13:37:20 +00:00Commented Jan 14, 2021 at 13:37
-
1@Majenko I posted the other message on the bottom again. I am a tiny step further now, I managed to get output from my thermal printer through the Serial2 port on my ESP32 (tx/rx on pin16/17). Unfortunately the output is all gibberish but consistent (baudrate is correct). I posted a topic here on the Adafruit forum: forums.adafruit.com/viewtopic.php?f=22&t=174116Thomas– Thomas2021年01月14日 20:06:10 +00:00Commented Jan 14, 2021 at 20:06
-
1ÊSP32 has three hardware serial ports (UARTS), so no need for SoftwareSerial. To use Serial1 and Serial2, see e.g. github.com/espressif/arduino-esp32/issues/…ridgy– ridgy2021年01月14日 23:59:08 +00:00Commented Jan 14, 2021 at 23:59
1 Answer 1
You need to use the <HardwareSerial. h> library. SoftwareSerial is for Arduino boards. "Thermal Printer Library" by Larry Bank is for GOOJPRT PT-210 and uses Bluetooth. Won't work for QR-701. Instead of using Adafruit Library, you can try with this: ThermalPrinter.
This May Help, Peter