void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
// since analogWrite() dont work in esp32, other ways r used:
// Setup(channel, frequency, resolution)
ledcSetup(0, 1000, 8);
// Pin(pin, channel)
ledcAttachPin(14, 0);
}
void loop() {
Serial.println(analogRead(34)); // slide btwn 0-4095
ledcWrite(0, analogRead(34)/16); // /16 to get btwn 0-255
}