Hey guys - pretty new to this...
I have a bit of code that I got from "SpikenzieLabs.com" which basically gets my arduino board to take a signal from a sensor and generate a midi tone - then using "Serial_Midi_Converter_V2" I can take the midi signal and patch it through to Logic or Garageband.
The problem I'm having, is that I want to be able to have multiple sensors (3 max) all running at once and sending different signals to different midi channels so that I can have more than one instrument playing at the same time but from different sensors...
Here is the code I've got (I've made some adjustments myself)
int note = 0;
int btnPin =13;
int knob =5;
void setup()
{
pinMode(btnPin, INPUT);
Serial.begin(57600); // Default speed of the Serial to MIDI Converter serial port
}
void loop()
{
int val = analogRead(knob);
val = map(val,0,1023,36,84);
int state=digitalRead(btnPin);
if (state==HIGH){
MIDI_TX(144,val,127); // NOTE ON
delay(100);
}
else{
MIDI_TX(128,val,127); // NOTE OFF
delay(100);
}
}
void MIDI_TX(unsigned char MESSAGE, unsigned char PITCH, unsigned char VELOCITY)
{
Serial.print(MESSAGE);
Serial.print(PITCH);
Serial.print(VELOCITY);
}
Does anyone have any ideas as I really know very very little about code!
Thanks ![]()