This is the code...If I use Max 7 Arduino plays a SINGLE NOTE but not with LMMS...
int velocity=100;
int noteON = 144;//144 = 10010000 in binary, note on command
int noteOFF = 128;//128 = 10000000 in binary, note off command
int note=50;
int fotoDO;
int fotoRE;
int fotoMI;
int fotoFA;
int fotoSOL;
int fotoLA;
int fotoSI;
int fotoDO8;
int pinbuzz=11;
int pinbuzz2=2;
int DO= 48 ;
int RE= 50 ;
int MI= 52 ;
int FA= 53;
int SOL= 55;
int LA= 57;
int SI= 59;
int DO8= 60 ;
void setup() {
Serial.begin(9600);
pinMode(11,INPUT);
pinMode(10,INPUT);
pinMode(9,INPUT);
pinMode(8,INPUT);
pinMode(7,INPUT);
pinMode(6,INPUT);
pinMode(5,INPUT);
pinMode(4,INPUT);
pinMode(pinbuzz,OUTPUT);
pinMode(pinbuzz2,OUTPUT);
}
void loop () {
fotoDO=analogRead(A0);
fotoRE=analogRead(A1);
fotoMI=analogRead(A2);
fotoFA=analogRead(A3);
fotoSOL=analogRead(A4);
fotoLA=analogRead(A5);
fotoSI=analogRead(A6);
fotoDO8=analogRead(A7);
Serial.println(fotoSOL);
if (fotoDO<50) {
MIDImessage(noteON, DO, velocity);
delay(200);
}
else MIDImessage(noteOFF, DO, velocity);
if (fotoRE<40) {
MIDImessage(noteON, RE, velocity);
delay(200);
}
else MIDImessage(noteOFF, RE, velocity);
if (fotoMI<50) {
MIDImessage(noteON, MI, velocity);
delay(200);
}
else MIDImessage(noteOFF, MI, velocity);
if (fotoFA<50) {
MIDImessage(noteON, FA, velocity);
delay(200);
}
else MIDImessage(noteOFF, FA, velocity);
if (fotoSOL<50) {
MIDImessage(noteON, SOL, velocity);
delay(200);
}
else MIDImessage(noteOFF, SOL, velocity);
if (fotoLA<50) {
MIDImessage(noteON, LA, velocity);
delay(200);
}
else MIDImessage(noteOFF, LA, velocity);
if (fotoSI<200) {
MIDImessage(noteON, SI, velocity);
delay(200);
}
else MIDImessage(noteOFF, SI ,velocity);
if (fotoDO8<150) {
MIDImessage(noteON, DO8, velocity);
delay(200);
}
else MIDImessage(noteOFF, DO8, velocity);
}
void MIDImessage(int command, int MIDInote, int MIDIvelocity) {
Serial.write(command);//send note on or note off command
Serial.write(MIDInote);//send pitch data
Serial.write(MIDIvelocity);//send velocity data
}