how to use SerialUSB.begin(9600); in arduino

hi sir how to use SerialUSB.begin(9600); in arduino mega adk....

On an Arduino Mega?

Not.

Where did you find SerialUSB?

DrDiettrich:
Where did you find SerialUSB?

On boards with native USB, it's a macro that aliases the main "Serial" instance:

I don't know about the Mega ADK though.

Pieter

in following link i find SerialUSB.Begin(); function......

DSMohan:
in following link i find SerialUSB.Begin(); function......

How To Use The Native USB Of The Arduino Due For High-Speed Communication - Copperhill

Thats for an Arduino DUE.

Dont expect the same thing to work on the Arduino Mega, it does not have the same components as the Arduino DUE.

hi sir its working on arduino due...

sir where i have seen the output....

if i connect a simple pendrive then how to see the data in pendrive... please help me...

So you are using an Arduino Due?

Can a Due act as USB host, or only as client? Your USB drive is no doubt client only.

Sure, the DUE should act as a USB Host to read a thumb drive.

The peripheral in charge to do that is UOTGHS on a Sam3x, but this is the most complex one.

Maybe you can try and understand how is written the USBHost library for the DUE, eventhough this library is designed for reading keyboard and mouse USB devices only.

If you need to dig further inside USB 2.0 protocol, I suggest this book from Benjamin David Lunt:
USB: The Universal Serial Bus, Chapter 17: Using the USB Mass Storage Device

In conjonction with the first parts of this tutorial to program your DUE as a USB Host:

https://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=7828517

very thanks sir....

one doubt where i seen usbserial outuput.....

This might help if you have a USB host shield. For more info, search for "arduino usbfat".