Routing arduino data to my main application

Hello everyone! newbie here and first post. :slight_smile:
I was wondering what would be the best way to route my arduino acquired data to my main application. What I’m trying to do is to change the parameters of my sliders based on some numbers i receive from by arduino script. To get the data from my Arduino I’m using this(GitHub - cpr2323/juce_serialport: Access hardware serial ports or USB virtual serial ports) library. Have you got any ideas?

Thanks!

Implement MIDI messages on the Arduino interface? Future-proof, easy to use/debug, and quite a lot easier to wire up to JUCE parameters than building your own parser.

As @ibisum says, if you go the serial route, you will have to implement your own packet system with a parser, etc. The MIDI route is another way to achieve this, assuming your data fits well into midi messages. Although I have not setup a MIDI interface on my Arduinos yet.

I use the serial library relatively often, so feel free to hit me up in a DM and I can try to help you get up and running.

1 Like

Arduino has TONS of MIDI libraries, for both generating standard messages and parsing them. I’ve used this for a few things and it works just fine:

Don’t forget you can add NRPN and SYSEX message types if you need larger datatypes, but for a lot of things you’d be surprised how far you can get with MIDI CC messages. Added bonus: pretty much instantly compatible with every DAW under the sun …

1 Like

I don’t see anywhere that this library makes the Arduino show up as a MIDI device over USB, is that correct? So, on the client side, you will still need code to read data from the usb serial port, and then pass it along, is that correct? Also, I see they provide a Python example, but no C++ example.

If this is true, unless one plans to use MIDI (and thus this might be the perfect library), it seems like all the extra midi handling code that you pull into your Arduino project will be wasted space.

Depending on the Arduino you are using, code space might be valuable. A simple parser (2 sig bytes, commnd, size, variable length payload) is less than 80 lines of code. add a handful of more lines if you want to throw in a CRC or something. then some conditional code to call the correct function for the command.

MIDI is a serial protocol, so the simplest way to use it would be to use the Arduino serial port to communicate to your app, and yes - depending on which Arduino you are using - you can enable USB-MIDI - see:

for example …