rdbischoff
Member
Ok, new thing that I've searched around and can't find how to fix it.
I've got a TRS input connected to my Teensy 3.6 with a Yamaha FC7 pedal plugged into the input.
T -> A13
R -> 3.3V
S -> GND
I took a screenshot of the Serial Plotter for the analogRead(A13). As you can see, the data at the bottom range of the pedal is about 300 and the highest appears to be right about it's max level of 1023 with a little variance. What do I need to do to get the bottom range of the pedal to be at 0? Shouldn't the bottom end be at 0?
I've got a TRS input connected to my Teensy 3.6 with a Yamaha FC7 pedal plugged into the input.
T -> A13
R -> 3.3V
S -> GND
I took a screenshot of the Serial Plotter for the analogRead(A13). As you can see, the data at the bottom range of the pedal is about 300 and the highest appears to be right about it's max level of 1023 with a little variance. What do I need to do to get the bottom range of the pedal to be at 0? Shouldn't the bottom end be at 0?
Code:
// the MIDI channel number to send messages
const int channel = 1;
// the MIDI continuous controller for each analog input
const int controllerA13 = 4; // 4 = hi hat foot control
/////////////////////
////// SET UP ///////
/////////////////////
void setup() {
Serial.begin(9600);
}
/// HI HAT CONTROL ///
// store previously sent values, to detect changes
int previousA13 = -1;
elapsedMillis msec = 0;
/////////////////
////// LOOP /////
/////////////////
void loop() {
//// HI HAT CONTROL ////
// only check the analog inputs 10 times per second,
// to prevent a flood of MIDI messages
if (msec >= 100) {
msec = 0;
int HH = analogRead(A13);
Serial.println("HH pedal");
Serial.print("\t");
Serial.println(HH);
int n0 = map(HH, 0, 1023, 0, 127);
// only transmit MIDI messages if analog input changed
if (n0 != previousA13) {
// only transmit MIDI if change is 1 or more
int diff = abs (n0 - previousA13);
if (diff > 0) {
usbMIDI.sendControlChange(controllerA13, n0, channel);
previousA13 = n0;
}
}
}
}