Creating queuing ticketing machine. What is a ticket? Yup, a ticket, I call it a ticket. It was a paper that we took or given usually used for parking, queuing to see a doctor, watching film and many others. For example, in a big shopping mall, the parking ticket is commonly given once we enter the mall. We ppressed the button on a machine box next to the portal gate then the ticket came out from that box. The paper was printed by a small printer inside the portal gate box.
Have you ever been queuing in a bank? Usually we take the queue number which also using a similar ticketing system with that.
The queue number or the parking paper was printed using a printer; generally the printer will print something on that paper once it is given a command or an instruction from the computer. But now have a look at the parking box or the bank queuing machine, some of them are big and the others are small in size. Look at the small one; is there any small computer? For today of course there is. But the small computer was not available in ancient times. Printing letters on a paper using a printer inside a small space could be done using a simple microcontroller to create a picture or a queue number.
Alright, for now I was going to show you my experiment on creating a printer for a simple ticketing machine. This machine is able to print a queued number using just a thermal printer and a microcontroller.
The basic program I used for this project was Arduino with standard library for the thermal printer.
The basic core from this project was a “count up”, its value was printed with a logo and an information of time showing when the ticket is created.
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
hitung+=1;
}
In a simple way, the coding for creating the count up was shown as the Arduino sketch above. First we read the status of the button pin and saved it in a buttonstate variable. Then based on that value we could use it for adding value or number available in “hitung variable” by writing the code “hitung+=1” similar as “hitung+1=”
[ads1]
When you finished adding number for every pressing button then we had to print out that number using thermal printer. That’s why I used standard library from adafruit for the thermal printer for easier printing process. For example, I printed the queued number just like the coding below.
printer.setSize('L');
printer.println(hitung);
“setSize” means that we were going to determine the font size used. I used the L (large) font and printed the number at “hiring” variable. Well, the coding only printed a single line. Simple, wasn’t it? Because I used the library printer.
For the thermal library printer, you can directly download it.
[button color=”red” size=”medium” link=”https://github.com/adafruit/Adafruit-Thermal-Printer-Library” icon=”” target=”false”]Library Arduino[/button]
Download the full coding below.
[sociallocker id=3486]
[button color=”green” size=”medium” link=”https://www.dropbox.com/s/1dcs94o7jfwqlvu/printer%20antrian.zip?dl=0″ icon=”” target=”false”]DOWNLOAD FULL CODING ARDUINO[/button]
[/sociallocker]
In the library, there was also an example of coding to print the barcodes, logos or pictures, big and small size of letters, writing orientation, etc. You can creatively develop it in which purpose you want. You can check my experiment result out from the following video.
Eksplorasi konten lain dari Duwi Arsana
Berlangganan untuk dapatkan pos terbaru lewat email.