Control surface library - error code

Hello all

I’ve put together a very simple midi controller using the control surface library and have come across a strange error when trying to set up to send midi messages 08 or 09 using the NoteButton function. I can send 00 to 07 then anything from 10, just not 08 and 09

Error message I’m getting at compile stage is Invalid digit “8” in octal constant, or 9 if I input that.

I have 8 NoteButton entries in my code and they are all exactly the same baring the midi note value. Can input any midi note value in any of the lines with no compile issues and uploads/works perfect. just not 08 or 09. Have tried 18 and 19 and they are fine.

NoteButton button1 = {
2, // push button 1 on pin 2
{08, CHANNEL_1}, // midi 08 on ch 1
};

Thanks

{08, CHANNEL_1},          // midi 08 on ch 1
};

Right there.

How could 8 be a valid octal digit?

Try changing them to just 8 or 9. Numbers beginning with 0 are considered to be in Octal, like numbers starting 0x are Hex. Octal numbers can only be 0-7 hence the error.

Steve

Well, that was my first thought but there’s no mention of the library using an octal number system and how would 18, 28, 38 etc be ok if it did.

All the numbers align perfectly with my midi device. 126 sends the midi note on/off value 126.

Just read your reply Steve and that’s the only thing I didn’t try. Sorry

Sorted!

how would 18, 28, 38 etc be ok if it did.

Because 18, 28, 38 are not octal literals - they lack a leading zero

Dave71:
Well, that was my first thought but there’s no mention of the library using an octal number system and how would 18, 28, 38 etc be ok if it did.

That has nothing to do with the library, it's just the C++ syntax for integer literals.
Try Serial.print(08); for example, it'll produce the same error.

Pieter