Update analogdemo.cpp
This commit is contained in:
parent
46ec54355a
commit
8bb4a2ff55
|
@ -1,4 +1,5 @@
|
|||
#include <ESPMegaPRO.h>
|
||||
#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
|
||||
}
|
Loading…
Reference in New Issue