ledcDetachPin(Pin) seems not working

Goal it to apply alternatively PWM to an output. Code below does not actually detach OutC. PWM stays on OutC an OutA stays always high.
Any clue, thanks.
//######################
void loop() {
potValue = analogRead(potPin);
Serial.println("Pot = " +String(potValue));
ledcDetachPin(OutA);
digitalWrite(OutA, HIGH); // on Pin 19
ledcAttachPin(OutC, 0); // Pin 22
ledcWrite(0, potValue); // (PWM_Ch, DutyCycle 0 ... 4095)
delay(5000);
ledcDetachPin(OutC);
digitalWrite(OutC, HIGH); // off Pin 22
ledcAttachPin(OutA, 0); // Pin 19
ledcWrite(0, potValue); // (PWM_Ch, DutyCycle 0 ... 4095)
// loop()
}

We ask that you post complete code. Read the forum guidelines to see how to properly post code and some hints on how to get the most from this forum.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

Where are the function definitions for the ledcDetachPin and ledcAttachPin functions?

What Arduino board?