Hi! currently a stumble an issue about my project. when i was picking a topic for my project and i already buy the hardwares and do coding as much as i can do. i've already create programming which can scan a barcode and display it on serial monitor. And i forget a little bit thing that is important element for this project...database. I know theres storage called EEPROM built in arduino, but i don't know how. even watching tutorial i still don't understand. by refer to my coding can someone help a bit of what i need to change or added to this programming
#include <hidcomposite.h>
#include <hidescriptorparser.h>
#include <hidusagestr.h>
#include <HID.h> //Add to Oleg Mazurov code to Bar Code Scanner
#include <hiduniversal.h> //Add to Oleg Mazurov code to Bar Code Scanner
#include <usbhub.h>
#include <avr/pgmspace.h>
#include <Usb.h>
#include <usbhub.h>
#include <avr/pgmspace.h>
#include <hidboot.h>
USB Usb;
HIDUniversal Hid(&Usb); //Add this line so that the barcode scanner will be recognized, I use "Hid" below
//HIDBoot<HID_PROTOCOL_KEYBOARD> Keyboard(&Usb);
class KbdRptParser : public KeyboardReportParser
{
void PrintKey(uint8_t mod, uint8_t key); // Add this line to print character in ASCII
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)
{
if(key!=19) Serial.print((char)key);
else Serial.println();
};
KbdRptParser Prs;
void setup()
{
Serial.begin(9600);
if(Usb.Init()==-1) Serial.println("OSC did not start.");
else Serial.println("Barcode Ready");
Hid.SetReportParser(0,(HIDReportParser*)&Prs); //Change "Keyboard" for "Hid"
}
void loop()
{
Usb.Task();
}