int potPin = 33;
int ledPin = 5;
int pwmFrequency = 1000;
int pwmRes = 8;
int pwmChan = 0;
void setup() {
Serial.begin(115200);
pinMode(ledPin, OUTPUT);
ledcAttachChannel(ledPin, pwmFrequency, pwmRes, pwmChan);
}
void loop() {
int potValue = analogRead(potPin);
int pwmValue = map(potValue, 0, 1023, 0, 255);
ledcWrite(pwmChan, pwmValue);
Serial.print("Potentiometer Value: ");
Serial.print(potValue);
Serial.print(" -> PWM Value: ");
Serial.println(pwmValue);
delay(10);
}
So im trying to use the LED with the potentiometer, is there anything wrong? Its my first time using ESP
The manufacturer of the ESP32-chip made breaking changes between ESP32-core versions 2.0.X and 3.X
So depending on the core-version that you are using you might have to adapt the code.
You can read about the differencies here
You posted one of this awful fritzimg pictures. This does not show your realitiy.
You should take high-resolution pictures from vertically above.
Take the picture and then look at the picture again if PCB-letters are easy to read and only in case you took the picture from vertically above it will be easy to see to what exact pin the wire is connected.
To state the obvious: Did you check the polarity of the LED?
best regards Stefan
Have you tried just writing a "HIGH" to the ledPin?