MIDIcontroller Library-MIDIdrum_FSR- limited MIDI velocity

Status
Not open for further replies.

digitalelements

Active member
Hi There,

I'm working with the MIDIcontroller library example for FSR sensors. My sensors are wired as suggested (10K Resistor )
So far I've been unable to get the FSR to send a MIDI velocity any higher than 105. I've taken the time to look at what the Teensy 4.0
sees at the analog input using the serial plotter which is in the neighborhood of 800-900. I've also had a look at parts of the source for the library
which show a inHi value of 1023. I've tinkered a bit with no success. Any suggestions would be greatly appreciated.

Code:
#include "MIDIcontroller.h"

/*This is an example of how to set up
  a velocity sensitive input using a
  force sensitive resistor.
  It's wired like so:
 
  3.3v--(FORCE RESISTOR)---\
                            )---Analog Pin
  GND--------/\/\/---------/
              10k
*/

byte MIDIchannel = 5;
const int pressPin = 23; // Change this to the correct ANALOG pin

// Note Parameters are: pin, note number
MIDIdrum myPad(pressPin, 37);

void setup(){
  // Set the threshold where you want notes to trigger.
  myPad.setThreshold(30);
}

void loop(){
  myPad.send();


// This prevents crashes that happen when incoming usbMIDI is ignored.
  while(usbMIDI.read()){}

// Also uncomment this if compiling for standard MIDI
//  while(MIDI.read()){}
}


From the .cpp source file.


Code:
MIDIdrum::MIDIdrum(int p, byte num): TouchVelocity(){
  pinMode(p, INPUT);
  pin = p;
  number = num;
  outLo = 1;
  outHi = 127;
  inputType = 0; // FSR or Piezo
  inHi = 1023;
  peak = 0;
  threshold = 12;
  state = 0;     // 0 = idle, 1 = looking for peak, 2 = ignoring aftershock
  waitTime = 36; // millis
  timer = 0;
};
 
Status
Not open for further replies.
Back
Top