Trouble with coding to make output go high for certain barcode being scanned

I am currently working on a project which requires me to scan a barcode, and depending on the barcode that is scanned, a certain output on my arduino will go high. My project requires 3 barcodes, so 3 outputs is all I need. I am using a QuantumT MS3850 barcode scanner, attached to a USB Host Shield 2.0 on my arduino uno. I tried to edit the example code USBHIDBootKbd to accomplish this but have not been having much success. Can anyone give me any suggestion as to what I should do or lead me in the right direction? Thank you in advance.

#include <hidboot.h>
#include <usbhub.h>
// Satisfy IDE, which only needs to see the include statment in the ino.
#ifdef dobogusinclude
#include <spi4teensy3.h>
#endif
#include <stdint.h>

 int pinout1 = 3;
 int pinout2 = 5;
 int pinout3 = 7;
 char input;
     
  

class KbdRptParser : public KeyboardReportParser
{
        void PrintKey(uint8_t mod, uint8_t key);

protected:
        virtual void OnControlKeysChanged(uint8_t before, uint8_t after);

	virtual void OnKeyDown	(uint8_t mod, uint8_t key);
	virtual void OnKeyPressed(uint8_t key);
};

void KbdRptParser::PrintKey(uint8_t m, uint8_t key)
{
    MODIFIERKEYS mod;
    *((uint8_t*)&mod) = m;
    Serial.print((mod.bmLeftCtrl   == 1) ? "C" : " ");
    Serial.print((mod.bmLeftShift  == 1) ? "S" : " ");
    Serial.print((mod.bmLeftAlt    == 1) ? "A" : " ");
    Serial.print((mod.bmLeftGUI    == 1) ? "G" : " ");

    Serial.print((mod.bmRightCtrl   == 1) ? "C" : " ");
    Serial.print((mod.bmRightShift  == 1) ? "S" : " ");
    Serial.print((mod.bmRightAlt    == 1) ? "A" : " ");
    Serial.println((mod.bmRightGUI    == 1) ? "G" : " ");
};

void KbdRptParser::OnKeyDown(uint8_t mod, uint8_t key)
{
    uint8_t c = OemToAscii(mod, key);
    
    if (c)
        OnKeyPressed(c);
}

void KbdRptParser::OnControlKeysChanged(uint8_t before, uint8_t after) {

    MODIFIERKEYS beforeMod;
    *((uint8_t*)&beforeMod) = before;

    MODIFIERKEYS afterMod;
    *((uint8_t*)&afterMod) = after;

    if (beforeMod.bmLeftCtrl != afterMod.bmLeftCtrl) {
        Serial.println("LeftCtrl changed");
    }
    if (beforeMod.bmLeftShift != afterMod.bmLeftShift) {
        Serial.println("LeftShift changed");
    }
    if (beforeMod.bmLeftAlt != afterMod.bmLeftAlt) {
        Serial.println("LeftAlt changed");
    }
    if (beforeMod.bmLeftGUI != afterMod.bmLeftGUI) {
        Serial.println("LeftGUI changed");
    }

    if (beforeMod.bmRightCtrl != afterMod.bmRightCtrl) {
        Serial.println("RightCtrl changed");
    }
    if (beforeMod.bmRightShift != afterMod.bmRightShift) {
        Serial.println("RightShift changed");
    }
    if (beforeMod.bmRightAlt != afterMod.bmRightAlt) {
        Serial.println("RightAlt changed");
    }
    if (beforeMod.bmRightGUI != afterMod.bmRightGUI) {
        Serial.println("RightGUI changed");
    }

}


void KbdRptParser::OnKeyPressed(uint8_t key)
{
   input = key;
    Serial.print(input);
     
}

USB     Usb;
//USBHub     Hub(&Usb);
HIDBoot<HID_PROTOCOL_KEYBOARD>    HidKeyboard(&Usb);

uint32_t next_time;

KbdRptParser Prs;

void setup()
{
    Serial.begin( 115200 );
    while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
    Serial.println("Start");

    if (Usb.Init() == -1)
        Serial.println("OSC did not start.");

    delay( 200 );

    next_time = millis() + 5000;

    HidKeyboard.SetReportParser(0, (HIDReportParser*)&Prs);
    
 pinMode(pinout1, OUTPUT);
 pinMode(pinout2, OUTPUT); 
 pinMode(pinout3, OUTPUT);

}


void loop()
{

  if (input == '764025613224')
   { 
     digitalWrite(pinout1, HIGH);
     delay(1000); 
     digitalWrite(pinout1, LOW);
   }
 Usb.Task();
   
}

moderator: Crosspost removed.

  if (input == '764025613224')

Single quotes are for single characters. Please post a picture of your keyboard, with the ONE key that you pressed to get that single character circled.

PaulS:

  if (input == '764025613224')

Single quotes are for single characters. Please post a picture of your keyboard, with the ONE key that you pressed to get that single character circled.

Thanks for the info. I'm scanning a barcode, so the "key being pressed" is actually the values of the barcode. I also printed out my own barcodes to make for easier numbers to use. I printed out a barcod numbered 0001, and now in my serial monitor it is output as:
48
48
48
49
19

While the 48 and 49 correspond to the 0 and 1, respectively, I did some research and the 19 at the end is for device control 3, which is a software flow control for transmit off.

When I scan a barcode now, I can see the those numbers on my serial monitor, but then the output pin does not go high. This is what I have now...

#include <usbhub.h>
#include <avr/pgmspace.h>
#include <Usb.h>
#include <hidboot.h>
  
 int pinout1 = 2;
 int pinout2 = 5;
 int pinout3 = 7;
 char* key[40];


 
USB     Usb;
//USBHub     Hub(&Usb);
HIDBoot<HID_PROTOCOL_KEYBOARD>    Keyboard(&Usb);
 
class KbdRptParser : public KeyboardReportParser
{
 
	virtual void OnKeyDown	(uint8_t mod, uint8_t key);
	virtual void OnKeyPressed(uint8_t key);
};
 
void KbdRptParser::OnKeyDown(uint8_t mod, uint8_t key)	
{
    uint8_t c = OemToAscii(mod, key);
 
    if (c)
        OnKeyPressed(c);
       
}
 
/* what to do when symbol arrives */
void KbdRptParser::OnKeyPressed(uint8_t key)	
{
 
    Serial.println( key );
 
}
 
KbdRptParser Prs;
 
void setup()
{
    Serial.begin( 115200 );
    Serial.println("Start");
 
    if (Usb.Init() == -1) {
        Serial.println("OSC did not start.");
    }
 
    delay( 200 );
 
    Keyboard.SetReportParser(0, (HIDReportParser*)&Prs);
    delay( 200 );
    
    pinMode(pinout1, OUTPUT); //sets pinout1 = 2 as an output
    
}

 
void loop()
{
  Usb.Task();
 if (key[30] == "4848484919")
 {
   digitalWrite(pinout1, HIGH);
   delay (1000);
   digitalWrite(pinout1, LOW);
 }
   
}

I'm scanning a barcode, so the "key being pressed" is actually the values of the barcode.

You are scanning barcodes to write your code? Bullshit!

 if (key[30] == "4848484919")

The pointer in the 30th element of the array of pointers is NEVER going to equal that string literal.

You might consider doing some research concerning strcmp().

It is not at all clear how the array of pointers (key) is ever populated. It is not clear why you think the 30th element of that array of pointers points to the value you are testing for.

Frankly, I think that the comment made by the fox to Pinocchio ("You're going a little too fast and in the wrong direction") applies here.

Edit: By the way, the characters that the serial monitor shows bear little relationship to the VALUES sent to it in some cases. The VALUE you are sending is '0' or '1', but the fact that you send it via a non-char variable causes the serial monitor to show "48" or "49". You can't compare '0' to "48" and expect to be told that they match. You can compare '0' to 48 and see that they match.

 if (key[30] == "4848484919")

You said earlier that the bar code reader gives a sequence of bytes valued at 48 48 48 19 19. That seemed sensible and plausible.

But how can you possibly think that that is the same as a string with "4848484919"?

The first 4 characters would probably match a string "0001"

Then, to be even more illogical, you seem to think that all 10 characters of "4848484919" will fit into a single character in your array.

Perhaps I shouldn't have used the word "think".

...R

Then, to be even more illogical, you seem to think that all 10 characters of "4848484919" will fit into a single character in your array.

The array is an array of pointers, not an array of chars, so, yes, "4848484919" will fit into a single element of the array. Well, the pointer to it would.