Weird output on serial monitor when uploaded (USB host shield & Arduino Mega)

Im trying to run the example of the Keyboard to Usb host connected in Arduino Mega .The output i get is in a weird language need help im facing such problems for almost most of my usb shield codes.Below are the codes example and the output image.

#include <avr/pgmspace.h>

#include <avrpins.h>
#include <max3421e.h>
#include <usbhost.h>
#include <usb_ch9.h>
#include <Usb.h>
#include <usbhub.h>
#include <avr/pgmspace.h>
#include <address.h>
#include <hidboot.h>

#include <printhex.h>
#include <message.h>
#include <hexdump.h>
#include <parsetools.h>

class KbdRptParser : public KeyboardReportParser
{
        void PrintKey(uint8_t mod, uint8_t key);
        
protected:
	virtual void OnKeyDown	(uint8_t mod, uint8_t key);
	virtual void OnKeyUp	(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(" >");
    PrintHex<uint8_t>(key, 0x80);
    Serial.print("< ");

    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)	
{
    Serial.print("DN ");
    PrintKey(mod, key);
    uint8_t c = OemToAscii(mod, key);
    
    if (c)
        OnKeyPressed(c);
}

void KbdRptParser::OnKeyUp(uint8_t mod, uint8_t key)	
{
    Serial.print("UP ");
    PrintKey(mod, key);
}

void KbdRptParser::OnKeyPressed(uint8_t key)	
{
    Serial.print("ASCII: ");
    Serial.println((char)key);
};

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

uint32_t next_time;

KbdRptParser Prs;

void setup()
{
    Serial.begin( 115200 );
    Serial.println("Start");

    if (Usb.Init() == -1)
        Serial.println("OSC did not start.");
      
    delay( 200 );
  
    next_time = millis() + 5000;
  
    Keyboard.SetReportParser(0, (HIDReportParser*)&Prs);
}

void loop()
{
    Usb.Task();
}

Please upload the image again, or copy the text.
I can't read it.

Check that your serial monitor has got the right port selected and is set to 115200 bps.

Erdin:
Please upload the image again, or copy the text.
I can't read it.

Try 'Google Translate' :slight_smile:

palmsecure:

You've got #include <avr/pgmspace.h> in there twice.

your code shows

Serial.begin( 115200 );

but in your serial monitor pic, I see it set to 9600. that would do it.

Start


01
--

Device descriptor: 
Descriptor Length:	12
Descriptor type:	01
USB version:		0200
Device class:		FF
Device Subclass:	00
Device Protocol:	50
Max.packet size:	40
Vendor  ID:		04C5
Product ID:		1084
Revision ID:		0100
Mfg.string index:	01
Prod.string index:	02
Serial number index:	00
Number of conf.:	01

Configuration descriptor:
Total length:		0027
Num.intf:		01
Conf.value:		01
Conf.string:		00
Attr.:			80
Max.pwr:		FA

Interface descriptor:
Intf.number:		00
Alt.:			00
Endpoints:		02
Intf. Class:		FF
Intf. Subclass:		00
Intf. Protocol:		50
Intf.string:		00

Endpoint descriptor:
Endpoint address:	82
Attr.:			02
Max.pkt size:		0040
Polling interval:	0A

Endpoint descriptor:
Endpoint address:	01
Attr.:			02
Max.pkt size:		0040
Polling interval:	0A

Endpoint descriptor:
Endpoint address:	83
Attr.:			03
Max.pkt size:		0008
Polling interval:	0A


Addr:1(0.0.1)

" Device class: FF
Device Subclass: 00
Device Protocol: 50 "

Hey Thanks All, changing the baudrate to 115200 works well.
But I'm experiencing a new problem, whereby my HID device has this device protocol as mention above. with this protocol, am i block from reading and interfacing any output from it? or do i have to write the protocol or hack the protocol before i can actually use its output and interface with it? Because when i plug in a keyboard or a mouse, it shows ( device protocol : 00 ).
PS: The numbers shown are in HEXADECIMAL