Xiao esp32c3 analogWrite all pins

hi, im trying to use analogWrite on all the pins of the board apart from D1, pins 0-6 work but 7-10 do not. i can get them to turn the connected leds on using digital write but it i change it to analogwrite only one side of the board works. does anyone know the reason? the pinout shows that pwm should work on all pins.

digitalWrite test code:

const int ledPins[] = { D0, D2, D3, D4, D5, D6, D7, D8, D9, D10 };  // LED pins:
const int numLEDs = 10;
// the setup function runs once when you press reset or power the board
void setup() {
  for (int i = 0; i < numLEDs; i++) {
    pinMode(ledPins[i], OUTPUT);
  }
}

// the loop function runs over and over again forever
void loop() {
  testLEDs();  // wait for a second
}

void testLEDs() {
  for (int i = 0; i < numLEDs; i++) {
    digitalWrite(ledPins[i], HIGH);  // Turn on random LED
    delay(1000);                     // Quick burst
    digitalWrite(ledPins[i], LOW);   // Turn off the LED
  }
}

analogWrite code

const int ledPins[] = { D0, D2, D3, D4, D5, D6, D7, D8, D9, D10 };  // LED pins:
const int numLEDs = 10;
// the setup function runs once when you press reset or power the board
void setup() {
  for (int i = 0; i < numLEDs; i++) {
    pinMode(ledPins[i], OUTPUT);
  }
}

// the loop function runs over and over again forever
void loop() {
  testLEDs();  // wait for a second
}

void testLEDs() {
  for (int i = 0; i < numLEDs; i++) {
    analogWrite(ledPins[i], 255);  // Turn on random LED
    delay(1000);                   // Quick burst
    analogWrite(ledPins[i], 0);    // Turn off the LED
  }
}

Hi there,
I don’t think it works on the C3 like that, The other ESP32’s it does.
I have seen this b4 , look for a thread on it , so meregister needs updated or written to first??
AGE …dam.
HTH
GL :slight_smile: PJ :v: