Hi im new in this! very new.
Ive viewed looked at many sketches from the internet, many of them are overwhelming and too much anve very impressing..
I also tryed to look at the Midi reference, but i just can figure out how to put the sketch together.
all the midi is a riddle for me!!
What i would like to do is, press a botton and send a midi cc "command"
and thats it, i know that this not is rocket science, but im finding it hard to understand.
the history behind this is that i would like a extra botten to control my guitar pedal ( a Boss GT-10 ) and within the i pedal i can activate "like an fx" if it reciewe a midi cc ( called CC#1 to 31 or 64 to 95 )
so if i can make the a botton send a midi cc command when pressed it would be great..
You don't want to send the CC message every time you detect the input to be high, so you need to only do this when you detect the switch gong from inactive state to active state (called "edge detection").
The last code you supplied does not use a switch at all?
Wrap the code to send the MIDI message in an if statement
if button is pressed
{
send midi message
}
Clearly you will need to write actual code, but that is the basic logic. If you are comfortable writing a function that returns true or false if the button edge has been detected, it is neater to wrap up the code in that sort of construct. Otherwise just write it inline in loop().
That code will not even compile using the latest Arduino IDE replace
Serial.print(0xB0, BYTE); // MIDI control change; channel 1
with
Serial.write(0xB0); // MIDI control change; channel 1
The same for the other two print statements.
Real the how to use the forum sticky to find out how to post code.
Look at the examples menu in the IDE for the basics of programming, they are simple examples.