Pitch and frequency measure exactly the same quantity, but on different scales.
Frequency is generally measured in Hertz, which counts the number of times per second that the vibrating object goes through a complete period of its vibration. For example, if the frequency is 440 Hertz, then the object goes through 440 complete periods of its vibration every second.
Pitch is generally measured in octaves, semitones and cents - a cent is a 1/100 of a semitone, and a semitone is 1/12 of an octave. It's not normally expressed as a numeric quantity, but instead, with letters and symbols. That's because there's no "zero point" as such, for pitch.
Because pitch and frequency measure the same thing, you can convert freely between them - rather like converting between temperatures expressed in Fahrenheit and in Celsius. The algorithm is a little complicated though - to work out a pitch, you need to take the DIFFERENCE between the base-2 logarithm of the frequency, and the base-2 logarithm of a frequency corresponding to a known pitch. The most commonly used value for this known pitch is "A above middle C" - it corresponds to a frequency of exactly 440 Hertz.
This conversion is best demonstrated with an example. Suppose I want to find the pitch corresponding to a frequency of 1000 Hertz. The base-2 logarithm of 1000 is 9.9657842847. The base-2 logarithm of 440 is 8.7813597135. The difference is 1.1844245711; which tells me that the pitch corresponding to 1000 Hertz is 1.1844245711 octaves above "A above middle C". Multiply this by 12 to give an answer in semitones - it's 14.21309485 semitones. Now 14 semitones above "A above middle C" is the "B" almost 2 octaves above middle C. The pitch that we're looking for is therefore 21.309485 cents above this "B".
The letter names are a bit confusing, because sometimes you go up 2 semitones to get to the next letter (so B is 2 semitones above A), and sometimes just 1 (so C is 1 semitone above B). They also repeat every octave (so 2 semitones above G isn't H, it's A). Musicians find this easy to deal with; the rest of us find it horribly confusing.
Now, when you play a single note on a musical instrument, the sound wave that you get has multiple frequencies, which you can find out with a Fourier analysis. The lowest frequency is called the "fundamental frequency", and the other frequencies are usually integer multiples of this frequency (which are called "harmonics" or "overtones"). So, if you play "A above middle C" on a piano, you'll get a composite sound, made up of a frequency of 440Hz, a frequency of 880Hz, a frequency of 1320Hz and so on - there could be dozens of these individual frequencies that make up your sound, all of them integer multiples of 440Hz. Now most musicians listening to this won't distinguish individual sounds for each frequency, so when a musician uses the word "pitch", they're normally referring to the pitch of the fundamental frequency ("A above middle C"), because that's the only pitch that is actually distinguishable.
If you're building a tuner, this is the definition of "pitch" that you will want to use; that is, your tuner should only display the pitches that a musician who hears the sound can actually distinguish. This means that after you've done a Fourier analysis, you need to remove these higher frequencies, before you calculate the pitches. I think (but I'm not sure about this part) that once you've got your set of frequencies from your Fourier analysis, you'll need to remove any frequencies that
- are an integer multiple, or very close to an integer multiple, of a lower frequency in the set
- have a notably lower amplitude than that lower frequency - but I'm not sure how much lower the amplitude has to be, before the higher pitch disappears into inaudibility (and it probably varies from one hearer to another).
To give another example, suppose I have a sound which includes frequencies of 262Hz, 440Hz, 524Hz, 786Hz, 880Hz, 1048Hz and 1320Hz, and the amplitude of each frequency is much greater than the amplitude of the frequency above. I notice that all the frequencies are multiples of 262Hz or 440Hz. So I conclude that this sound has just two "fundamental frequencies", and therefore consists of just two musical notes, or just two pitches (roughly middle C and the A above). The higher pitches are certainly components of the sound, but they are harmonics. The harmonics won't be audible to anyone hearing the sound; and therefore should not be displayed by your tuner.
To that extent, pitch as perceived by a musician is a psychological effect, which makes it hard to model in an electronic tuner. You may have to do some experimentation, to work out exactly when a higher pitch should be considered a separate note, and when it should be considered a harmonic. Also, many musicians will be able to hear pitches that the Fourier analysis doesn't pick up (summation tones and difference tones) - their hearing really does play tricks.