//code by Chris Ball - chrisballprojects.wordpress.com //modified by Angel Palomares, works 100% const int notes=6; // set up number of notes boolean notePlaying[notes]; //note states array: keeps track of whether a MIDI note is "on" or "off" int scale[notes]={0,2,4,5,7,9}; //major scale int beginNote=0X3C; //starting note value (default middle C) int threshold=40; //value which analogRead() must cross for a midi note to be triggered boolean midiMode=true; //set this to "true" before uploading MIDI firmware (http://hunt.net.nz/users/darran/weblog/52882/Arduino_UNO_MIDI_USB_version_02.html) to 16u2 void setup(){ if(midiMode){ pinMode(A0, INPUT_PULLUP); pinMode(A1, INPUT_PULLUP); pinMode(A2, INPUT_PULLUP); pinMode(A3, INPUT_PULLUP); pinMode(A4, INPUT_PULLUP); pinMode(A5, INPUT_PULLUP); Serial.begin(115200); //midi USB baud rate = 115200 }else{ pinMode(A0, INPUT_PULLUP); pinMode(A1, INPUT_PULLUP); pinMode(A2, INPUT_PULLUP); pinMode(A3, INPUT_PULLUP); pinMode(A4, INPUT_PULLUP); pinMode(A5, INPUT_PULLUP); Serial.begin(9600); //for testing values } } void loop() { for(int i=0;ithreshold)&&(notePlaying[i]==false)){ //note on & CC messages int note=beginNote+scale[i]; midiMessage(0x90, note, 65);//, 100); notePlaying[i]=true; } if((analogRead(i)