Hi,
I'm a complete newbie when it comes to arduino.
But i do have some coding background but i'm not in the Computer sciences or technical trade.
I purchased and arduino usb shield and was able to download the standard barcode scanner from Circuitsathome.com.
I removed all elements of the LCD screen and for now I just need the the serial monitor to display Character values when I scan from barcode.
For example, if i scan X000K6ATJR it displays the following:
88
48
48
48
75
54
65
84
74
82
19
This is hex and i have no experience working with hex. Is there a way of when I scan i can display the string?
The reason for this is, i need to see the string X000K6ATJR and eventually set up arrays to break up the string to 4 components and place this into another array.
It might seem easy for the experts but i'm just struggling with the basics of the arduino IDE. The coding shouldn't be an issue for me.
=====code below======
#include <avr/pgmspace.h>
#include <Usb.h>
#include <usbhub.h>
#include <avr/pgmspace.h>
#include <hidboot.h>
#define DISPLAY_WIDTH 16
USB Usb;
//USBHub Hub(&Usb);
HIDBoot<HID_PROTOCOL_KEYBOARD> Keyboard(&Usb);
class KbdRptParser : public KeyboardReportParser
{
protected:
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)
{
static uint32_t next_time = 0; //watchdog
static uint8_t current_cursor = 0; //tracks current cursor position
if( millis() > next_time ) {
}
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);
}
void loop()
{
Usb.Task();
int val = Serial.read() - '0';
}