Author Topic: Barcode not able to scan, arduino, Adafruit_Thermal library  (Read 675 times)

0 Members and 1 Guest are viewing this topic.

Offline Vindhyachal.taknikiTopic starter

  • Frequent Contributor
  • **
  • Posts: 490
Barcode not able to scan, arduino, Adafruit_Thermal library
« on: September 27, 2019, 07:54:07 am »
I am using latest Adafruit_Thermal library, arduino mega 2560 & using it to print barcode. Issue is barcode is printed but my mobile app is unable read it. tried multiple apps also, but not reading.
Attached is code & output print.

I have tried almost all opotions in adafruit lib like CODE39, CODE93 & others, all gets pritned but not able to scan.

need to print digits only 0 to 9 only. In image attached, top part is removed it had customer info.Text is printed correctly no issues.


Code: [Select]
void print_barcode(uint16_t g_serial_number)
{
    uint8_t temp1;
    uint16_t temp;
    char_t barcode_str[14];
    char_t serial_number_bytes[5] = {' ', ' ', ' ', ' ', ' '};
   
   
    temp = g_serial_number;
   
    temp1 = temp % 10U;
    serial_number_bytes[4] = temp1 | 0x30U;

    temp = temp / 10U;
    temp1 = temp % 10U;
    serial_number_bytes[3] = temp1 | 0x30U;     

    temp = temp / 10U;
    temp1 = temp % 10U;
    serial_number_bytes[2] = temp1 | 0x30U;   

    temp = temp / 10U;
    temp1 = temp % 10U;
    serial_number_bytes[1] = temp1 | 0x30U;   

    temp = temp / 10U;
    temp1 = temp % 10U;
    serial_number_bytes[0] = temp1 | 0x30U;               


    for(cnt = 0; cnt < 8U ; cnt++)   // fill with zeros
    {
        barcode_str[cnt] = '0';
    }
   
    for(cnt = 0; cnt < 5U ; cnt++)
    {
        barcode_str[cnt+8] = serial_number_bytes[cnt];
    }

    barcode_str[13] = '\0';
    printer.setBarcodeHeight(19);
    printer.printBarcode(&barcode_str[0], CODE39);

     
    Serial1.write(14);  //move to next label
   
}


 

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 3051
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
Re: Barcode not able to scan, arduino, Adafruit_Thermal library
« Reply #1 on: September 27, 2019, 07:59:53 am »
Make it taller, try with less data.  Maybe you can use a QR
~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf