How to feed data to an arduino leonardo

I was wondering if it would be possible to say plug the arduino into a computer and have the computer send the arduino data packets that the arduino will then process, but I don't mean uploading sketches to the arduino, I mean making a sketch that would allow it to accept data as it is sent. Is this possible?

Yes, that's possible. When you connect your arduino, it will show as a com: port on your PC. Since your PC may have different serial ports, your PC programm needs to address the right one. Speed settings in both PC-program and your sketch should also match.

When it comes to handling datapackets, you may want to check how it's done best. Crunching huge amounts of data is for example best done by the PC itself. It probably operates a few hundred times faster as an arduino and may have a million times more ram available.

In your sketch you can simply use Serialbegin() serialRead() and other Serial-commands to communicate with the program on PC. On your PC it doesn't really matter what language/IDE you use, as long as it can handle the serial port.

This link has an example showing how you can communicate between a PC and an Arduino using Python on the PC. The general principle will be the same for any programming language. I know the Arduino program works on an Uno and I THINK I tested it on a Leoonardo. If it doesn't work on the Leonardo it will only need a minor modification.

...R