analog SDK

This commit is contained in:
Siwat Sirichai 2023-10-12 19:36:47 +07:00
parent 35cbbbf295
commit 46ec54355a
4 changed files with 18 additions and 15 deletions

View File

@ -10,5 +10,6 @@
"initializer_list": "cpp",
"adafruit_ads1x15.h": "c"
},
"cmake.configureOnOpen": true
"cmake.configureOnOpen": true,
"cmake.sourceDirectory": "D:/Git/ESPMegaPRO-v3-SDK/Template Project/.pio/libdeps/wt32-eth01/Adafruit BusIO"
}

View File

@ -0,0 +1,16 @@
#include <ESPMegaPRO.h>
void setup()
{
Serial.begin(115200);
ESPMega_begin();
}
void loop()
{
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);
}
}

View File

@ -1,14 +0,0 @@
#include <ESPMegaPRO.h>
void setup()
{
Serial.begin(115200);
ESPMega_begin();
ESPMega_dacWrite(0,2000);
ESPMega_dacWrite(1,2000);
}
void loop()
{
delay(100);
}