Barcode not able to scan, arduino, Adafruit_Thermal library

Thread Starter

Vindhyachal Takniki

Joined Nov 3, 2014
594
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:
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
   
}


Untitled.png
 
Top