Show Posts
Pages: [1]
1  Using Arduino / Audio / Potentiometer Send MIDI CC on: January 31, 2013, 08:02:45 pm
Hello Everyone

I was wondering from the midi example that is available on Arduino Software
if its possible to send MIDI like that but with a potentiometer controlling both
Note and Velocity with different potentiometer's with serial.write

If there are examples available or someone that did something close to this
i would really appreciate your tips and solutions.

Thanks you very much
2  Using Arduino / Audio / Re: Button on/off over serial TX/MIDI on: January 19, 2012, 01:44:55 pm
Now my arduino mega allways stays with the TX light on, how do we fix this?
3  Using Arduino / Audio / Re: Button on/off over serial TX/MIDI on: January 17, 2012, 10:56:16 pm
How do you code to make the switch ON when its pressed and OFF when not pressed. on the digital input. Applyed on this code.
4  Using Arduino / Audio / Re: Button on/off over serial TX/MIDI on: January 14, 2012, 09:35:16 pm
Well do you have any example of to save the last position and not sending until it moves again?
5  Using Arduino / Audio / Re: Button on/off over serial TX/MIDI on: January 14, 2012, 02:15:14 pm
Alright thanks for the advice.

The first code regarding serial communication reads 8 potentiometers and send's the midi value trough TX, after that
i have it connected to a midi cable that connects to an audio interface ( alesis i/o 26 )
and so far so good i have the values, and everything is going good pretty much like i wanted.

But now i dont have any ideia how to read the digital button (with the second code i posted) and send that value over midi,
since i have buttons that switch on, and when i take my finger it goes off, mostly like a BANG.
And i want to convert it to a real switch   [ press 1 time > ON, press again >OFF ] the problem is
the buttons probably gives 127 when its pressed and 0 with no finger on.

So any clues on how this should work??

6  Using Arduino / Audio / Button on/off over serial TX/MIDI on: January 14, 2012, 11:48:04 am
Hi there everyone, i'm trying to send a message trough TX serial ouput. the two codes i got for my project are this ones.

Code:
void setup()
{
   Serial.begin(31250);       // Default speed of MIDI serial port
   pinMode(13, OUTPUT);       // Light LED on pin 13 to notify of readynes
   digitalWrite(13, HIGH);
}

int iAn0Val, iAn1Val, iAn2Val, iAn3Val, iAn4Val, iAn5Val, iAn6Val, iAn7Val, iAn8Val;

void loop()
{
   //Slider 1
   int iAn0ValPrev = iAn0Val; //Get the previous value of slider 1
   iAn0Val = analogRead(0)/8;
   analogPinMidiTX(1,iAn0Val,iAn0ValPrev); //TX the value of slider 1
  
   //Slider 2
   int iAn1ValPrev = iAn1Val; //Get the previous value of slider 2
   iAn1Val = analogRead(1)/8;
   analogPinMidiTX(2,iAn1Val,iAn1ValPrev); //TX the value of slider 2
  
    //Slider 3
   int iAn2ValPrev = iAn2Val; //Get the previous value of slider 3
   iAn2Val = analogRead(2)/8;
   analogPinMidiTX(3,iAn2Val,iAn2ValPrev); //TX the value of slider 3
  
    //Slider 4
   int iAn3ValPrev = iAn3Val; //Get the previous value of slider 4
   iAn3Val = analogRead(3)/8;
   analogPinMidiTX(4,iAn3Val,iAn3ValPrev); //TX the value of slider 4
  
    //Slider 5
   int iAn4ValPrev = iAn4Val; //Get the previous value of slider 5
   iAn4Val = analogRead(4)/8;
   analogPinMidiTX(5,iAn4Val,iAn4ValPrev); //TX the value of slider 5
  
   //Slider 6
   int iAn5ValPrev = iAn5Val; //Get the previous value of slider 6
   iAn5Val = analogRead(5)/8;
   analogPinMidiTX(6,iAn5Val,iAn5ValPrev); //TX the value of slider 6
  
   //Slider 7
   int iAn6ValPrev = iAn6Val; //Get the previous value of slider 7
   iAn6Val = analogRead(6)/8;
   analogPinMidiTX(7,iAn6Val,iAn6ValPrev); //TX the value of slider 7
  
   //Slider 8
   int iAn7ValPrev = iAn7Val; //Get the previous value of slider 8
   iAn7Val = analogRead(7)/8;
   analogPinMidiTX(8,iAn7Val,iAn7ValPrev); //TX the value of slider 8
  
}

void analogPinMidiTX(int iChan, int iVal, int iValPrev)
{  
  //only TX the value over midi if it is changed, as to prevent spamming the midi port and thus confusing the receiving application in learning mode
  if(iValPrev != iVal)
  {
    MidiTX(176,iChan,iVal);
  }
}

void MidiTX(unsigned char MESSAGE, unsigned char CONTROL, unsigned char VALUE) //pass values out through standard Midi Command
{
   Serial.print(MESSAGE);
   Serial.print(CONTROL);
   Serial.print(VALUE);
}



at this time i am able to send the value of a 4K7 potentiometer over midi to control Pan in Logic Pro 9, but now i have 8 buttons (bang tipe not trigger) and i want to send the message in the same way, but at the sime time i want this bang buttons to be trigger so that when i press 1 time it gives high and it stay HIGH, and only get's LOW when i press again.

Here is the Code i have for the digital button read.

Code:
// constants won't change. They're used here to
// set pin numbers:
const int buttonPin = 2;     // the number of the pushbutton pin
const int ledPin =  13;      // the number of the LED pin

// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);      
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);    
}

void loop(){
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {    
    // turn LED on:    
    digitalWrite(ledPin, HIGH);  
  }
  else {
    // turn LED off:
    digitalWrite(ledPin, LOW);
  }
}


Thanks in Advance
Pages: [1]