arduino 101 analogRead issue

I’m creating a project that that varies the tone output by a piezo by using a potienitiometer. Unfortunatley, I keep getting the wrong reading form the analogRead() using the serial monitor when I connect the pot to ground it alternates between a reading of 0 and about 250 or so. Why is this??? as well a instead of hearing a gradual change in tone, I hear only three distinct tones. I’m also wondering if there’s any way I could make it smooth instead ofconstant beeping??

My code:

#include <stdio.h>
#include <Wire.h>
#include “rgb_lcd.h”
#include <CurieBLE.h>
rgb_lcd lcd;
const int readPin = A0;
const int speakPin = 2;
int r = 10;
int b = 100;
int g = 50;
void setup() {
Serial.begin(9600);
pinMode(speakPin, OUTPUT);
lcd.begin(16,2);
lcd.setRGB(r, g, b);

}
int voltage;
int freq;
void loop() {

// lcd.clear();
delay(500);

voltage = analogRead(readPin);
//lcd.print(voltage);
Serial.print(freq);
Serial.print(“f v”);
Serial.println(voltage);
freq=((voltage-5)*2);
if (voltage<10){
freq=0;
}
noTone(speakPin);
tone(speakPin, freq);

}

The 101 is 3.3 volt. If your potentiometer is around 5k or more, you wire one outer pin to ground, the other outer pin to 3.3 volt and the wiper pin to A0. ( I guess the analog pin on the 101 tolerates 3.3 volts). You should then get a range of 0 to 1023 (assuming a 10 bit adc). Use the map() function to convert that to your desired frequency range.