-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how can I open the cash drawer? #50
Comments
I don't have cash drawer to test it, // send pulse pin to pin2
escpos.pulsePin(EscPos.PinConnector.Pin_2,25,250);
// OR send pulse pin to pin5
escpos.pulsePin(EscPos.PinConnector.Pin_5,25,250); |
I've googled a bit and found that each printer has a code for that, which would have to send the code like this: |
java translation:
I saw a lot of combinations on http://keyhut.com/popopen4.htm depending of your printer's brand/model you can put other values... |
don't forget to send feedback .. |
i don't have a cash drawer so i cannot try it. But if i could get one i will coment it. |
and with this command you are sending the ascii codes?: |
yeap, |
The code is not needed to open the box as the box opens automatically when printing a ticket |
I think that it is dependent of printers configuration / setup... |
Hi anastaciocintra, So, what I don't understand is, do we need to pass the values listed here http://keyhut.com/popopen4.htm or is it enough to use the pulsePin method? |
Hi @cemkoeylue, the lib have one funtion for this, it is based on https://github.com/mike42/escpos-php. another point is that after research, we discover (here on this issue) that the sequence of commands to open the cash-drawer is dependent of brand/ model of the printer. so, if you have one cash-drawer and what to test it, you can code something like that: // info on http://keyhut.com/popopen4.htm
// manufacturer 3NSTAR
// model LPT005
// Drawer Codes 27,112,0,25,250
public void myOpenCashDrawer(EscPos escPos) throws IOException {
escPos.write(27).write(112).write(0).write(25).write(250);
} After all, comments regarding the tests are welcome, its to improve our lib. |
Hi @anastaciocintra ,
This is of course for one specific printer with a specific brand name. But let's assume that we have only printer, for example an Epson receipt printer. We pass the printer name and we send the commands (27,112....etc) to the printer and that printer should open the cash drawer, right? |
Yes Now |
I have one cash drawer and a recept printer and gonna test this and gonna update you. Thank you for your great library btw! |
I mean |
Yes, I have a real equipment and I am going to test this. |
Good |
I can confirm that this works. I tested it with an EPSON TM T20II, although my codes were different.
|
I can confirm that this sequence is working with ZKTeco 5000 & ZKTeco 8000 (which are very generic printers)
|
I'm using pulsePin method and it's working. The issue I'm having is the cashdrawer periodically open. I need to restart the app or the printer in order to make it work again. Any idea how can i solve this. I can confirm this is not related to hardware |
@onipun in my case I'm using this: the pin can be PIN_5 or PIN_2 (0 or 1) int pin_dest = pin.equals("PIN_2") ? 0 : 1;
logger.info("Open drawer on ESCPOS device pin: " + pin_dest);
escpos.write(27).write(112).write(pin_dest).write(25).write(250);
escpos.close(); check the .close() method, also use a try/catch and try to close in catch section also to be sure that the port is closed (or .close in the finally clause too) |
@VictorChavezMX sorry. This is embarrassing. It is the hardware connection issue. Before this i just unplug and plug back the rj11 cable. After cleaning up a bit it's working with current pulsePin code |
nice!!! once i was testing with the rj11 plugged into the rj45 port lol!! |
and what command should be sent to open the cash drawer?
Originally posted by @palanganero in #49 (comment)
The text was updated successfully, but these errors were encountered: