arduino-esp32/libraries/ESP32/examples/AnalogOut/SigmaDelta/SigmaDelta.ino

19 lines
367 B
C++

void setup()
{
//setup channel 0 with frequency 312500 Hz
sigmaDeltaSetup(0, 312500);
//attach pin 18 to channel 0
sigmaDeltaAttachPin(18,0);
//initialize channel 0 to off
sigmaDeltaWrite(0, 0);
}
void loop()
{
//slowly ramp-up the value
//will overflow at 256
static uint8_t i = 0;
sigmaDeltaWrite(0, i++);
delay(100);
}