'fscale' was not declared in this scope

Hi! So to give a bit of context, I've been following this guide by silveirago on Github: GitHub - silveirago/Theremidi

Whenever I try to verify the code this error pops-up on the terminal (Arduino IDE):

C:\Users\bruh\Downloads\New folder (7)\Theremidi\D_POTENTIOMETERS.ino: In function 'void readPotentiometers(int)':
C:\Users\bruh\Downloads\New folder (7)\Theremidi\D_POTENTIOMETERS.ino:17:18: error: 'fscale' was not declared in this scope
   scaledVal[i] = fscale(IR_range[0], IR_range[1], IR_min_val[i], IR_max_val[i], filteredVal[i], IR_curve);
                  ^~~~~~
C:\Users\bruh\Downloads\New folder (7)\Theremidi\D_POTENTIOMETERS.ino:17:18: note: suggested alternative: 'fscanf'
   scaledVal[i] = fscale(IR_range[0], IR_range[1], IR_min_val[i], IR_max_val[i], filteredVal[i], IR_curve);
                  ^~~~~~
                  fscanf
C:\Users\bruh\Downloads\New folder (7)\Theremidi\D_POTENTIOMETERS.ino:25:15: error: 'clipValue' was not declared in this scope
   IR_val[i] = clipValue(scaledVal[i], IR_min_val[i], IR_max_val[i]);
               ^~~~~~~~~

exit status 1

Compilation error: 'fscale' was not declared in this scope

Ah, and for more information, this is part of the code I ran:

/////////////////////////////////////////////
void readPotentiometers(int i) {


  // one pole filter
  // y[n] = A0 * x[n] + B1 * y[n-1];
  // A = 0.15 and B = 0.85

  reading[i] = analogRead(POT_ARDUINO_PIN[i]); // raw reading
  ave[i].push(reading[i]); // adds value to average pool

  //float filteredVal = filterA * reading + filterB * potPState[i]; // filtered value
  filteredVal[i] = ave[i].mean();
  potCState[i] = filteredVal[i];

  //fscale( float originalMin, float originalMax, float newBegin, float newEnd, float inputValue, float curve) - linearize curve
  scaledVal[i] = fscale(IR_range[0], IR_range[1], IR_min_val[i], IR_max_val[i], filteredVal[i], IR_curve);

  pitchBendVal = fscale(IR_range[0], IR_range[1], 0, 16383, filteredVal[i], IR_curve);

  // sets the value to the desired range
  //rangedVal[i] = map(scaledVal[i], IR_range[0], IR_range[1], IR_min_val[i], IR_max_val[i]);

  // clips IR value to min-max
  IR_val[i] = clipValue(scaledVal[i], IR_min_val[i], IR_max_val[i]);

I'm not really sure if the function should be defined by the library or if I should manually define it myself, and if so, how do I do that exactly? I would really appreciate your help, thank you!

fscale is a function. It is a version of the map() function that works with floating point numbers. The map() function is written to be used with integral data types only.

This thread has a function definition and how it is defied and used. Help with fscale function

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.