I am trying the else I can still not dynamically update the value without releasing.
exactly the same as before
#include <MIDI.h>
#define LED 13
int sensorPin = A0;
int tempVal = 0;
int led = 13;
int note = 0;
int scale[] = {
60,62,64,65,67,69,71};
void setup() {
pinMode(LED, OUTPUT);
MIDI.begin();
}
void loop(){
tempVal = analogRead(sensorPin);
if(tempVal == 0) {
MIDI.sendControlChange(123,0,1); // OMNI NOTE OFF MSG
digitalWrite(led, LOW);
}
else if (tempVal > 1) {
note = map(tempVal, 1023, 1, 6, 0);
note = constrain(note, 0, 6);
MIDI.sendNoteOn(scale[note],127,1);
digitalWrite(led, HIGH);
}
}