/*
ESP32 DAC - Simple Waveform Experiment
espdac-wave.ino
ESP32 DAC Waveform Demo
Outputs a Sine Wave
DroneBot Workshop 2022
https://dronebotworkshop.com
*/
// Define DAC pins
#define DAC_CH1 25
#define DAC_CH2 26
void setup() {
// Nothing here!
}
void loop() {
// Generate a Sine Wave
// Step one degree at a time
for (int deg = 0; deg < 360; deg = deg + 1) {
// Calculate sine and write to DAC
dacWrite(DAC_CH1, int(128 + 64 * sin(deg * PI / 180)));
}
}