Project 9 extra challenge

Thanks for the reply, I just finished the analog exercise and I have tweaked my code a bit, I'm getting mixed results.

I did read the 'How to use this forum' post, unfortunately it was after I had posted the code. I will be sure to use the proper protocol going forward.

I now am dividing the A0 by 4 and having the analogRead act on that number. What is happening is that I'm only seeing vary small variances in the Serial window, on the upper end of the pot it reads 255, on the other end it reads 251. I may be doing something wrong.

const int switchPin = 2;
const int motorPin = 9;
int switchState = 0;
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
pinMode(motorPin, OUTPUT);
pinMode(switchPin, INPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
int sensorValue = analogRead(A0/4);
Serial.println(sensorValue);
delay(1);
switchState = digitalRead(switchPin);

if(switchState == HIGH) {
  analogWrite(motorPin, sensorValue);
}
else{digitalWrite(motorPin, LOW);}
}