Need help with an Error

I am fairly new to coding, and cannot understand why I have this particular error:
MIDI_CC_SEND.ino:2:23: error: expected ',' or '...' before numeric constant
MIDI_CC_SEND.ino:6:23: error: expected ',' or '...' before numeric constant
Return code is not 0

Here is my code:
void setup(){
pinMode(3, INPUT);
pinMode(4, OUTPUT);
}

void sendMIDI(uint8_t 0xB, uint8_t 50, uint8_t 127) {

if (digitalRead(3) == HIGH){
    digitalWrite(4, HIGH);
    delay(500);
    Serial.write(0xB);
    Serial.write(50);
    Serial.write(127);
 }

}

I cannot see any errors but I am probably just having a bad look. Many thanks to whoever can help.

Welcome to the forum

Please post your full sketch

In my experience the easiest way to tidy up the code and add the code tags is as follows
Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

which are lines 2 & 6?

Hi, @rang33lxa
Welcome to the forum.

The link will show you how to post your code.

Please repost your code in a new post.

What model Arduino are you using?

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

You can't use an explicit digits in function definition:

void sendMIDI(uint8_t 0xB, uint8_t 50, uint8_t 127)

Rather than digits, a names of variables must be here:

void sendMIDI(uint8_t x, uint8_t y, uint8_t z)
{
if (digitalRead(3) == HIGH){
    digitalWrite(4, HIGH);
    delay(500);
    Serial.write(x);
    Serial.write(y);
    Serial.write(z);
 }
}

which will be replaced with values at time the code will call the function:

sendMIDI(0xB,50,127);

I have applied this to my code, and it has fixed the issue, but now I am getting another error:
/coreBuild/core.a(main.cpp.o): In function main': /sdk/hardware/arduino/cores/arduino/main.cpp:14: undefined reference to loop'
collect2: error: ld returned 1 exit status
Return code is not 0

Sorry I didn't know how to post code before

void setup(){
    pinMode(3, INPUT);
    pinMode(4, OUTPUT);
}

void sendMIDI(uint8_t x, uint8_t y, uint8_t z) {
    
        Serial.write(x);
        Serial.write(y);
        Serial.write(z);
        sendMIDI(0xB,50,127);
        delay(5000);
     
    
}

PS I have changed my code to get the concept right first
-Axel

Your sketch must have a loop() function in it even if it is empty

I have been wanting to make a MIDI controller for my boss RC-5 looping station. I have looked at many different tutorials and sites to try and find a solution, but all of them do not specifically send a cc command through a din connector, which is what I've been looking for.

More specifically, all I have to do is send an ON signal over CC channels 80-87 when I press certain buttons. I have tried many codes but cannot get this to work.

I would love some help in how to do this.

-Axel👍

Thankyou. This worked perfectly.

it can't be that.
You call sendMIDI() function inside the function itself.:

While this is acceptable in some cases (it's called "recursion"), in your case it's absolutely the wrong approach. As a result, it created an infinite loop in your code.
In addition, you didn't call the function anywhere else in your code, that make the function completely useless.
I recommended you not going further until you read the C programming book chapter about function definition and calling.

Can you please post your attempt ( don't forget code tags when posting code ), tell what arduino you are using and show your wiring (a schematic).

I have merged your topics due to them having too much overlap on the same subject matter @rang33lxa .

In the future, please only create one topic for each distinct subject matter and be careful not to cause them to converge into parallel discussions.

The reason is that generating multiple threads on the same subject matter can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.

Thanks in advance for your cooperation.

I have been wanting to make a MIDI controller for my boss RC-5 looping station. I have looked at many different tutorials and sites to try and find a solution, but all of them do not specifically send a cc command through a din connector, which is what I've been looking for.

More specifically, all I have to do is send an ON signal over CC channels 80-87 when I press certain buttons. I have tried many codes but cannot get this to work and as in have said I am new and hardly know where to start.

I also use an android tablet for coding using ArduinoDroid, if this makes any difference. Anything that could help me understand this would be appreciated.

As for a schematic I am just using a simple 5pin DIN out, and haven't stuck with a specific code. I am using an Arduino Uno and don't really want to buy anything new if I don't have to.


*Pot is din connector

-Axel

Why did you use a 3v3 output for your DIN connector? Is it mean that your midi device has a 3v3 logic level? - in that case you need a logic level converter to connect 5v Arduino to it.

Sorry! I think I was actually using 5v

@rang33lxa
In order for the forum to help you, you must provide the code you tried to send messages with. Without the code, there is simply nothing to discuss in this thread.

I have tried countless codes, all of which have failed and have had no effect watsoever. The most recent one is already posted on this discussion. I don't have any clue how to send a MIDI CC command and am requesting ideas and assistance.

That code is completely wrong as I wrote you above.
It can't work because the function sendMIDI() doesn't called anywhere in the program. If you fixed this by adding the call, say, in the loop() - you make the infinite loop in the code.

Your actual problem is not with the MIDI sending - the issue that you don't even have a basic understanding of how Arduino programs are written and what parts they consist of. You don't know what variables and values ​​are, you don't know how to create and use functions.

You need to start with something simpler - for example, with Arduino examples for working with LEDs and buttons.

I have done some basic coding tutorials, but it is clear I need more. Thankyou.