Control speed of DC Motor with potentiometer

int sensorValue = 0;
int outputValue = 0;
int transistorPin = 2;
int analogInPin = ?; // you must state which analog pin you are using
void setup() {
pinMode(transistorPin, OUTPUT);
}

void loop() {
sensorValue = analogRead(analogInPin); // sensorValue = analogRead(analogInPin)/4;
// the map function will perform the /4, don't do it twice

outputValue = map(sensorValue, 0, 1023, 0, 255);
analogWrite(transistorPin, sensorValue);
}