gianluca-nitti / printserver-esp8266

GNU General Public License v3.0
165 stars 32 forks source link

Please, help( #14

Closed koller18 closed 4 years ago

koller18 commented 4 years ago

Hello! There is an hp laserjet 1100 printer with lpt. Could you give me a sketch for DirectParallelPortPrinter, but I can't do it. I'm not very good at programming. And tell me what you need to change for esp32. 😘

gianluca-nitti commented 4 years ago

Hello,

you can use a DirectParallelPortPrinter by replacing in printserver.ino everything between the last #include "PrintQueue.h" and void setup() with the following snippet:

#define STROBE 10
#define BUSY 9
int DATA[8] = {D0, D1, D2, D3, D4, D5, D6, D7};
DirectParallelPortPrinter printer("lpt1", DATA, STROBE, BUSY);

Printer* printers[] = {&printer1};

#define PRINTER_COUNT (sizeof(printers) / sizeof(printers[0]))
TcpPrintServer server(printers, PRINTER_COUNT);

however, depending on the board you are using, you may need to change the following values in the first 3 lines: 10 with the number of the pin connected to the LPT port's strobe pin, 9 with the pin connected to the LPT's busy pin and D0...D7 with the pins connected to the 8 LPT data pins.

Unfortunately I don't have experience with the ESP32 and never tested this project on one but it should work as long as you have arduino-esp32 installed.

Also, make sure to update the (CH375-Arduino)[https://github.com/gianluca-nitti/CH375-Arduino] library to the latest version, otherwise it will likely fail to compile (see final comments on #13 for details).