輸出PWM

int K;

void setup()

{

ledcSetup(0,5000,8);

ledcAttachPin(4,0);

ledcWrite(0, 0);

}

void loop()

{

for (K = 1; K <= 255; K++) {

ledcWrite(0, K);

delay(200);

}

}