Yes. Thank you. That is correct. Pot is connected to A1 and reads value correctly. Led is on Pin 3 (PWN capable) and displays correctly when using digitalWrite(ledPin, HIGH)
Please post a couple of pages of serial monitor output, one grabbed when digitalWrite() is being used, and the other when analogWrite() is being used. Post each batch of serial monitor output in its own set of code tags.
If strange things are happening when "nothing" is happening during the delay(), then I suspect wiring. If you are using a solderless breadboard, the connections may be rusted.
Your sketch is moderated as follows: (I assume that you have a 1k/2k series resistor with LED.) upload the sketch, slowly rotate the pot, and chcek that the brightness of LED chnages.
// simple LED with POT to adjust brightness (10k resistor and POT)
int ledPin = 3;
int potPin = A1;
int potValue, outputValue;
void setup()
{
Serial.begin(9600);
Serial.println("Starting: ");
}
void loop()
{
potValue = analogRead(potPin); // <---- First read reports 0 when void setup
outputValue = map(potValue, 0, 1023, 0, 255);
digitalWrite(ledPin, outputValue); // When using analogWrite(ledPin,
delay(1000);
}
I see now you wanted then in code tags and I put them as images. Noted for next time. For now the issue is resolved by correct wiring. The behavior shown with analogWrite is unexpected since it works as expected with digitalWrite. However, this should not have worked given the wiring correction. Thanks for taking the time.