Parsing esp8266 led commands to esp32 not working

I have code that works flawlessly on the Esp8266. I recently began migrating everything to the lolin wroom d32.

Everything I have been able to successfully move and update and run without errors except for when it comes to rgb led functions

I have a 4 pin rgb originally on esp8266 I used analogWrite and had it on pins 456 Gnd

Now on the esp 32 I have it on pins 12, 13, 14, Gnd
I have tried to use ledcWrite with no success. When I do it kicks my code saying a tone of undeclared issues. I tried globals and no luck

Here is the cpp that is in my original esp8266 form. I figure it’s better to post what I knew worked before and hopefully someone can help me make the changes . I’m very green so if you can be specific with examples of what in need to change o would appreciate it

I tried just replacing analogWrite and 254 to 1023 but that didn’t work either

Esp8266 version that works correctly

// LightClass::LightClass() {
  
// }

void LightClass::begin() {
  EEPROM.begin(14);
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
  digitalWrite(redPin, HIGH);
  digitalWrite(greenPin, HIGH);
  digitalWrite(bluePin, 

    case INTERFACE_tSET3:
      if (EEPROM.read(6) == 255 && EEPROM.read(7) == 255 && EEPROM.read(8) == 255) {
        Serial.println(F("\n EMPTY SETTINGS ON MEMORY FOR COLOR\n"));
        // int redLevel = 0;
        // int greenLevel = 255;
        // int blueLevel = 255;
        return;
      }
      redLevel   = EEPROM.read(6);
      greenLevel = EEPROM.read(7);
      blueLevel  = EEPROM.read(8);
      break;
  }
}// END Function

    case LIGHT_ACTIVATE:
      if (previousActivatelTime == 0) {
        Serial.println(F(" - - - > Getting in Activate Phase"));
        previousActivateTime = millis();
        COM.on();
        on();
      }
      if (pattern) {
        blink();
      }
      if (millis() - previousActivateTime > goalDelay) {
        Serial.println(F(" - - - > Out of Activate Phase"));
        COM.off();
        off();
        status = LIGHT_PAUSED;
        wipeCounter();
      }
      break;

   
  }
  analogWrite(redPin, redTempLevel);
  analogWrite(greenPin, greenTempLevel);
  analogWrite(bluePin, blueTempLevel);
}

   Function - Test Activate Function
*/
void LightClass::test( bool _comm ) {
  if (previousTestTime == 0) {
    Serial.println(F(" - - - > Getting in Test Phase"));
    previousTestTime = millis();
    if (_comm) {
      COM.on();
    }
    on();
  }
  if (pattern) {
    blink();
  }
  if (millis() - previousTestTime > testDelay)  {
    Serial.println(F(" - - - > Out of Test Phase"));
    if (_comm) {
      COM.off();
    }
    off();
    status = LIGHT_PAUSED;
    wipeCounter();
  }
}



LightClass Lights;

Try an absolute minimal example in accordance with ledc tutorials first, not your huge sketch.

For example, code from

or “LEDC Write RGB example” from

https://espressif-docs.readthedocs-hosted.com/projects/arduino-esp32/en/latest/api/ledc.html

Only if that works you move on. Otherwise, post the thrown error messages.

I’m not sure what you mean. I have tried those sketches but that does not solve my problem of migrating to the d32. From the esp8266.

Like I said just replacing analogWrite with ledcWrite did not work. So actual assistance not just pointing me to a website would be appreciated. Thanks in advance.

And they worked succesfully? That’s the important part.

Your not answering my question

Yes I can write a new sketch and they work fine. I use them all the time. Both them. That is not the issue

That is not solving my issue with the migration.
When I do make the change to my sketch to follow EXACTLY as an example ig I’d not working.

Thanks for actually helping with what to fix in my code