Any way to Increase output speed for Keyboard.print??

I'm trying to input a relatively large amount of text (28k) into a text editor using Keyboard.print. While it's inputting correctly, and relatively fast, it's still taking several minutes before everything is finally put in there. Is there some way to have it just dump the whole 28k of text in seconds, instead? Here's the (slow) code I've come up with.. any advise on what should I do to change it?

#include "Keyboard.h"
void setup() {
// put your setup code here, to run once:

void loop() {
// put your main code here, to run repeatedly:

Keyboard.print(F("25k code was here but I replaced it with this text")) ;

Keyboard.end() ;
exit(0) ;


any advise on what should I do to change it?

Remove the 5 second delay?
Put the keyboard begin call in the setup function where it belongs.

exit(0) ;

Does that even do anything on an Arduino?


exit(0) ;

Does that even do anything on an Arduino?

The code will enter an endless loop.

From stdib.h

   The exit() function terminates the application.  Since there is no
   environment to return to, \c status is ignored, and code execution
   will eventually reach an infinite loop, thereby effectively halting
   all code processing.  Before entering the infinite loop, interrupts
   are globally disabled.

   In a C++ context, global destructors will be called before halting
extern void exit(int __status) __ATTR_NORETURN__;

As stated, simplest start is to put keyboard.begin(); in setup. No reason for it to start over and over in the loop.

keyboard.end() is not really required unless you are using another serial function I believe?

Now for the data you are sending. It will transmit more effectively if you send it in chunks versus all at once. Using a keyboard input means the PC will interpret it like you are typing and has control over it with keyboard settings.

The chunk size needs to be adjusted to whatever works best with buffer/baud and generally what works best. Without knowing the source of your 28k data, it is hard to help there.