was not declared in this scope

I have 2 sketches that work, but when I try to combine them I get this error,
any idea what im doing wrong?

errors

Arduino: 1.8.9 (Mac OS X), Board: "Generic STM32F103C series, STM32F103CB (20k RAM. 128k Flash), Serial, 72Mhz (Normal), Smallest (default)"

/Users/lee/Documents/Arduino/touch_pedal_graph/touch_pedal_graph.ino: In function 'void loop()':
touch_pedal_graph:205:135: error: 'DrawBarChartV' was not declared in this scope
                 DrawBarChartV(tft, 10,  290, 30, 160, 0, 4095 , 409, bvolts , 4 , 0, GREEN, DKBLUE, BLUE, WHITE, BLACK, "MIX", graph_1);
                                                                                                                                       ^
touch_pedal_graph:208:1: error: a function-definition is not allowed here before '{' token
 {
 ^
touch_pedal_graph:251:1: error: expected '}' at end of input
 }
 ^
touch_pedal_graph:251:1: error: expected '}' at end of input
touch_pedal_graph:251:1: error: expected '}' at end of input
touch_pedal_graph:251:1: error: expected '}' at end of input
touch_pedal_graph:251:1: error: expected '}' at end of input
touch_pedal_graph:251:1: error: expected '}' at end of input
touch_pedal_graph:251:1: error: expected '}' at end of input
Multiple libraries were found for "Adafruit_ILI9341.h"
 Used: /Users/lee/Documents/Arduino/libraries/Adafruit_ILI9341
 Not used: /Users/lee/Library/Arduino15/packages/stm32duino/hardware/STM32F1/2019.6.29/libraries/Adafruit_ILI9341
exit status 1
'DrawBarChartV' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

the problem part, full sketch is attached, it wouldn’t let me post it all here

                }


                bvolts = analogRead(PB0);
                DrawBarChartV(tft, 10,  290, 30, 160, 0, 4095 , 409, bvolts , 4 , 0, GREEN, DKBLUE, BLUE, WHITE, BLACK, "MIX", graph_1);
              }               
void DrawBarChartV(Adafruit_ILI9341 & d, double x , double y , double w, double h , double loval , double hival , double inc , double curval ,  int dig , int dec, unsigned int barcolor, unsigned int voidcolor, unsigned int bordercolor, unsigned int textcolor, unsigned int backcolor, String label, boolean & redraw)
{

touch_pedal_graph.ino (7.23 KB)

Where does the loop() function end ?

If you Auto Format the sketch in the IDE the problem may be more obvious

thank you for the nudge in the right direction, I cleaned up the braces and figured it out

i’m also struggling to figure out how to increase the range of my vu meter,
it works from a pot, 0-3.3v
but from my guitar signal theres barely any movement
from my dmm I’m using 0-0.2v (approx)

  bvolts = analogRead(PB0);
 DrawBarChartV(tft, 10,  290, 30, 160, 0, 4095 , 409, bvolts , 4 , 0, GREEN, DKBLUE, BLUE, WHITE, BLACK, "MIX", graph_1);
}

void DrawBarChartV(Adafruit_ILI9341 & d, double x , double y , double w, double h , double loval , double hival , double inc , double curval ,  int dig , int dec, unsigned int barcolor, unsigned int voidcolor, unsigned int bordercolor, unsigned int textcolor, unsigned int backcolor, String label, boolean & redraw)
{

  double stepval, range;
  double my, level;
  double i, data;
  // draw the border, scale, and label once
  // avoid doing this on every update to minimize flicker
  if (redraw == true) {
    redraw = false;

    d.drawRect(x - 1, y - h - 1, w + 2, h + 2, bordercolor);
    d.setTextColor(textcolor, backcolor);
    d.setTextSize(2);
    d.setCursor(x , y + 10);
    d.println(label);
    // step val basically scales the hival and low val to the height
    // deducting a small value to eliminate round off errors
    // this val may need to be adjusted
    stepval = ( inc) * (double (h) / (double (hival - loval))) - .001;
    for (i = 0; i <= h; i += stepval) {
      my =  y - h + i;
      d.drawFastHLine(x + w + 1, my,  5, textcolor);
      // draw lables
      d.setTextSize(1);
      d.setTextColor(textcolor, backcolor);
      d.setCursor(x + w + 12, my - 3 );
      data = hival - ( i * (inc / stepval));
    //  d.println(Format(data, dig, dec));
    }
  }
  // compute level of bar graph that is scaled to the  height and the hi and low vals
  // this is needed to accompdate for +/- range
  level = (h * (((curval - loval) / (hival - loval))));
  // draw the bar graph
  // write a upper and lower bar to minimize flicker cause by blanking out bar and redraw on update
  d.fillRect(x, y - h, w, h - level,  voidcolor);
  d.fillRect(x, y - level, w,  level, barcolor);
  // write the current value
  d.setTextColor(textcolor, backcolor);
  d.setTextSize(2);
  d.setCursor(x , y - h - 23);
 // d.println(Format(curval, dig, dec));

}

Option A: Amplify the signal
Option B: Use a lower analog reference like the 1,1V internal reference on a lot of boards. And expect the value to be lower then 1023 still.