I get the concept of the extra challenge question on project 9. Activating the transistor using a PWM pin, and I have done that using the:

analogWrite(motorPin, 255); or 90 or 0 etc...

but how would I run that using a potentiometer through the Analog input? I would need to calculate the Analog input 0 - 1023(?) and then correlate that with a PWM 0 - 255,I'm just a bit uncertain as to what to type in to program that.

Does this make any sense?

Thanks

The challenge is:Try hooking up a potentiometer to an analog input and use that to PWM the pin that controls the transistor.

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.