Pages: [1]   Go Down
Author Topic: Simple Midi cc send with a botten ?? Help.  (Read 1124 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi im new in this! very new. smiley-eek
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"

im with so far:

int buttonPin = 2;

void setup() {
   Serial.begin(31250);
}
void loop ()
if (buttonState == HIGH) {     
 
 Serial.Write

----------------
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..

   
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

is this it??? exept the baud rate?

void setup() {
Serial.begin(57600); // open serial port
}

void loop() {

Serial.print(0xB2, BYTE); // MIDI control change; channel 3
Serial.print(1, BYTE); // MIDI controller #1
Serial.print(127, BYTE); // MIDI controller value of 127
 
}
Logged

Sydney, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1260
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thats right.

Just before i went to bed i found the cc code, i think?

But yes.  When the botten is pressed i would like to send the midi data. And it well send again when i press the botten again.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 smiley-mr-green

UHU!!! I got some life ( or communication )  or, this is a BIG step for me !!!!

i tryed this code, and are now avaible to use a pot to send the midi cc


byte val = 0;

void setup() {
Serial.begin(31250);
}

void loop() {
val = analogRead(0) / 8;
 
Serial.print(0xB0, BYTE); // MIDI control change; channel 1
Serial.print(1, BYTE); //    CC#1
Serial.print(val, BYTE); // MIDI controller value from potentiometer 1
delay(5);
}

but, i  still need to get my botton to work with it ? du i change the val to a number ? and why does the sketch starts with " byte val = 0 " ??
Logged

Sydney, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1260
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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().
Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 604
Posts: 33448
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

That code will not even compile using the latest Arduino IDE replace
Code:
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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh yes, i didnt mention that im using ide version 0023, with the newer version wont eat the BYTE command
Logged

Pages: [1]   Go Up
Jump to: