const int led = 5;
const int led2 = 2;
const int freq = 5000; //frquencia
const int canal1 = 0; //canal led 1, 0 - 15
const int canal2 = 1; // canal led 2, 0 - 15
const int resolution = 8; //resoluçao 1-20 bits
int pot = 4;
int p = 0;
void setup() {
Serial.begin(115200);
ledcSetup(canal1, freq, resolution);
ledcSetup(canal2, freq, resolution);
ledcAttachPin(led, canal1);
ledcAttachPin(led2, canal2); //unir os canais ao gpio a ser controlado
pinMode(pot, INPUT);
}
void loop() {
p = analogRead(pot);
p = map(p, 0, 4095, 0, 255);
Serial.println(p);
ledcWrite(canal2, p);
ledcWrite(canal1, p);
delay(10);
delay(1000);
}