From 8bb4a2ff554bf081c0318c6be17ffec4c2259e54 Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Thu, 12 Oct 2023 19:40:50 +0700 Subject: [PATCH] Update analogdemo.cpp --- Template Project/src/analogdemo.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Template Project/src/analogdemo.cpp b/Template Project/src/analogdemo.cpp index a796b6e..7627678 100644 --- a/Template Project/src/analogdemo.cpp +++ b/Template Project/src/analogdemo.cpp @@ -1,4 +1,5 @@ #include +#define ADC void setup() { @@ -8,9 +9,14 @@ void setup() void loop() { + #ifdef DAC for(int i=0;i<4096;i++) { ESPMega_dacWrite(0,i); double dac_val_sine = 2047.5*sin(i*2*PI/2047.5)+2047.5; ESPMega_dacWrite(1,(int)dac_val_sine); } + #endif + #ifdef ADC + Serial.printf("A0: %d",ESPMega_analogRead(0)); + #endif } \ No newline at end of file