So this is how my setup looks. The potentiometer is connected to Analog 0, power and ground. The motor is connected to digital pin 11 and ground.
Everything is connected on a breadboard, forgot to draw the square to simulate it hope it makes sense.
My arduino code:
int analogInPin = A0;
int analogOutPin = 11;
int sensorValue = 0;
int outputValue = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
sensorValue = analogRead(analogInPin);
outputValue = map(sensorValue, 0, 1023, 0, 255);
analogWrite(analogOutPin, outputValue);
Serial.print("sensor = " );
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(outputValue);
delay(10);
}