How to make sketch send data to bootloader?

I have a arduino UNO and MPR121.
MPR121 only have arduino library I found.
I use LUFA to compile a Bootloader.
I want sketch send data to Bootloader then Bootloader send packets to the USB Host.

Is there Any way to do this or example project?

I buy arduino UNO only 5days.I'm new with Microcontrollers.But I'm a software engineer for 8 years.


You have a VERY flawed idea of how a bootloader works!

Just implement LUFA in your code!

Do you mean implement LUFA in sketch code?


The main processor on an Arduino Uno does not have support for USB, and can not run LUFA. Normally it sends data to the host computer via the "Serial" interface (which is a UART, on the Uno), and the conversion from Serial to USB is done by a separate chip. This chip doesn't have any access to the IO pins, so it can't talk to the MPR121.

There are a lot of examples for communicating from the Arduino to a host PC, but almost all of them use the Serial.xxxx functions on the Arduino, and a virtual COM port on the PC side. This makes them a lot simpler and more portable than something that uses native USB.

In theory, you can load new firmware into the USB/Serial chip, which is re-programmable ATmega16u2 on a genuine Arduino. Examples exist for emulating Mouse, Joystick, Midi, Keyboard, and perhaps others. Many Arduino "clones" have a different USB/Serial chip that is not re-programmable.
In any case, this would usually be considered an "advanced" topic; writing new firmware for the 16u2 to support some other USB Device type would require using something other than the Arudino environment.

If you need native USB support for some reason, you would be much better off choosing an Arduino variant that does have USB Hardware, like the Arduino Micro (ATmega32u4), or any of the SAM-based boards (Zero, etc.)