Need help with MIDI library Pitchbend.

I am trying to add PitcgBend to this scetch. I have spent many hours trying but I end with errors or without pitch bend.
I have two pots and one switch. One pot gives note number and switch press will play it. the second pot should add PB value.
You can probably tell that I have no clue what i am doing.

#include <MIDI.h>
const int switchPin = 2;  // The switch is on Arduino pin 2
 const int middleC = 33;    // Middle C (MIDI note value 60) is the lowest note we'll play
 byte note = 0; // The MIDI note value to be played
 byte pitch = 0;
 int val = 0;        // value from the analog input0
 int val2 = 1;    // value from the analog input1
 int lastNotePlayed = 0;     // note turned on when you press the switch
 int lastSwitchState = 0;    // state of the switch during previous time through the main loop
 int currentSwitchState = 0;

 void setup() {
   pinMode(switchPin, INPUT);
 MIDI.begin(1);
 MIDI.sendProgramChange(12,1); 
 }

 void loop() {
   
 val2 = analogRead(1); //pitch bend value
pitch = val2;
  val = analogRead(0); //note number
   note = val/8;
   currentSwitchState = digitalRead(switchPin);
   if (currentSwitchState == 1) {
     if (lastSwitchState == 0) {
       noteOn(0x90, note, 0x40);
       lastNotePlayed = note;
     }
   }
   else { 
     if (lastSwitchState == 1) {
       noteOn(0x90, lastNotePlayed, 0x00);
     }
   }
   lastSwitchState = currentSwitchState;
   
    }
 void noteOn(byte cmd, byte data1, byte  data2) {
   Serial.print(cmd, BYTE);
   Serial.print(data1, BYTE);
   Serial.print(data2, BYTE);
    delay(100);
 }
    void pitchBend(byte data1, byte data2) {
    Serial.print(data2, BYTE);
   Serial.print(data1, BYTE);
}

Well there were so many. Mostly typos in anyway.
However when I tried very simple sketch that will play note and bend its pitch I get this

o: In function loop': undefined reference to MIDI_Class::sendPitchBend(int, unsigned char)'

#include <MIDI.h>
byte note = 0;
byte val = 0;
int AnalogValue = 5; 
  
void setup() {

 MIDI.begin(1); 
  MIDI.sendProgramChange (12,1);
}

void loop() {
    MIDI.sendNoteOn(54,127,1);
  delay(1000);
    MIDI.sendNoteOff(54,127,1);
    val = analogRead(0);
   MIDI.sendPitchBend(val,1);
     }

Answered in the software forum.