I am using ESP32 and arduino to generate 1.7 MHz signal. I got a 5 kHz test code working, but I am having trouble with high frequencies. Do I need to enable some specific high speed mode or should the code below work?
const int ledPin = 32;
const int freq = 1700000;
const int ledChannel = 0;
const int resolution = 4;
void setup(){
ledcSetup(ledChannel, freq, resolution);
ledcAttachPin(ledPin, ledChannel);
ledcWrite(ledChannel, 7);
}
void loop(){}
I reformatted your code, please use code tags next time. (press the </> icon in the tool bar and paste your code (make sure you indented the code in the IDE before copying, that's done by pressing ctrlT on a PC or cmdT on a Mac)