Hey guys
I wanted to use a flex sensor as a trigger to a random list of sounds. I know i may have to use Max, bc my teacher taught us, but i don't know how. I have this code to connect the arduino uno to max
byte noteON = 144;//note on command
int analogPin = A0;
void setup() {
Serial.begin(9600);
}
void loop() {
int analogVal = analogRead(analogPin);//read data
//we have to scale the lsr data to fit between 0 and 127 (this is the range of MIDI notes)
byte note = map(analogVal, 0, 900, 0, 127);//falta mudar as variaveis
MIDImessage(noteON, note, 100);//turn note on
delay(300);//hold note for 300ms
MIDImessage(noteON, note, 0);//turn note off (note on with velocity 0)
delay(200);//wait 200ms until triggering next note
}
//send MIDI message
void MIDImessage(byte command, byte data1, byte data2) {
Serial.write(command);
Serial.write(data1);
Serial.write(data2);
}