Controlling midi data with arduino

Greetings! I am creating a midi controller using 3 potentiometers and have run in to a bit of a problem.

I aim to create a delay within MAX MSP for use in Ableton. Simply, it is a controller but specifically I will use it as a delay controller.

So far I have built the circuit but have bumped into a small problem with the code.

The error report I am receiving is;

'Serial.print(val, uint8_t); // MIDI controller value from potentiometer 3


exit status 1
expected primary-expression before ‘)’ token’

I have tried changing a few things but unfortunately, my skills aren’t quite up to the standards you are all perhaps used to so my apologies if this is a forehead smacking question.

Also, I have adapted the code from previous work and I am unsure whether what I have wrote so far is correct for what I am trying to achieve;

  • controlling x 3 delay parameters; time, repeat, level. with x 3 pots, creating a max patch that talks to the Arduino and finally, presenting the delay parameters within MAX presentation mode so that I can use the patch within Ableton, controlling the delay parameters with the pots.

I have attached my code so that you can have a closer look.

I have already changed the previous BYTE to uint8_t as Arduino said BYTE was no longer in use, any help would be much appreciated.

kind regards, Dr Bongo

CONTROLLER-FINAL.ino (978 Bytes)

What on earth are you trying to do passing a type as the second argument to Serial.print()?

I have no idea what the intent is there, but it's wrong. See the documentation for Serial.print():

An optional second parameter specifies the base (format) to use; permitted values are BIN (binary, or base 2), OCT (octal, or base 8), DEC (decimal, or base 10), HEX (hexadecimal, or base 16). For floating point numbers, this parameter specifies the number of decimal places to use.

Maybe what you want is to drop the second argument alltogether, and instead use Serial.write()?

Thank you for your reply and the warm welcome

Serial.write was what I needed so thanks again

I’ve found an example that I have modified for the purpose of my aim. It seems to do what I want but I am receiving unknown characters in the Serial window when I move the pots. I have tried changing the Baum rate but it’s still spitting out what looks like WEBDINGS/WINGDINGS font. Would anyone know if this be a problem when I connect Arduino to MaxMSP?

I will attach the code again for anyone to have a look over. ^.^

Once I’ve got it all working I will upload the code and the Max Patch :slight_smile:

potcontrol.ino (1.51 KB)

Hi Doctor Bongo

Yeah, it does have a frosty atmosphere on here sometimes. Sorry about that. At least if you can make it past the brittle attitude, the advice is usually good.

Those funny characters you see in serial monitor - I don't think you need to worry about them. It's just how MIDI data looks to the serial monitor.

I think things will work out OK when you connect your synth module.

Your code looks OK as far as I can see.

By the way, this is probably the wrong section of the forum for your question. Programming Questions would probably have got your question a bit more attention.

Best of luck!