we use barcode reader with usb. Connectig it with aduino(UNO). All we want to realizing is next. At first, scanning a barcode and its information is save in variable A. and send it to the second computer with bluetooth. Doing this process several times, and fnally, displaying all information in second computer. For this, we made two programs. One is for senging information with BT, and the other is reading barcode numbers with scanner. we wanted to intergrate it, but it is too hard for us. please help...!! This is specific code..! BARCODE SCANNING #include <liquidcrystal.h> #include #include <avrpins.h> #include <max3421e.h> #include <usbhost.h> #include <usb_ch9.h> #include <usb.h> #include <usbhub.h> #include #include <address.h> #include <hidboot.h> #include <printhex.h> #include <message.h> #include <hexdump.h> #include <parsetools.h> #define DISPLAY_WIDTH 16 // initialize the LCD library with the numbers of the interface pins LiquidCrystal lcd(7, 6, 5, 4, 3, 2); 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 ) { lcd.clear(); current_cursor = 0; delay( 5 ); //LCD-specific lcd.setCursor( 0,0 ); }//if( millis() > next_time ... next_time = millis() + 200; //reset watchdog if( current_cursor++ == ( DISPLAY_WIDTH + 1 )) { //switch to second line if cursor outside the screen lcd.setCursor( 0,1 ); } if( (key != 19) && (key != 106)) { Serial.println( key - 48 ); lcd.print( key - 48 ); } }; KbdRptParser Prs; void setup() { Serial.begin( 9600 ); Serial.println("Start"); if (Usb.Init() == -1) { Serial.println("OSC did not start."); } delay( 200 ); Keyboard.SetReportParser(0, (HIDReportParser*)&Prs); // set up the LCD's number of columns and rows: lcd.begin(DISPLAY_WIDTH, 2); lcd.clear(); lcd.noAutoscroll(); lcd.print("Ready"); delay( 200 ); } void loop() { Usb.Task(); }</hid_protocol_keyboard></parsetools.h></hexdump.h></message.h></printhex.h></hidboot.h></address.h></usbhub.h></usb.h></usb_ch9.h></usbhost.h></max3421e.h></avrpins.h></liquidcrystal.h>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)