const int ledPin = 2; // LED引脚
const int channel = 0; // 通道号
const int freq = 5000; // 频率
const int bitNum = 8; // 占空比的分辨率
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
pinMode(ledPin, OUTPUT);
ledcSetup(channel, freq, bitNum);
ledcAttachPin(ledPin, channel);
ledcWrite(channel, 60);
delay(1000);
ledcWrite(channel, 255);
}
void loop() {
// put your main code here, to run repeatedly:
}