Skip to content

Commit

Permalink
add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
RobTillaart committed Sep 19, 2023
1 parent 2829072 commit 22b7610
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions examples/AD568X_sinus/AD568X_sinus.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//
// FILE: AD568X_demo.ino
// AUTHOR: Rob Tillaart
// PUPROSE: test basic behaviour and performance


#include "AD568X.h"

AD5683 AD16_HW(8);
AD5683 AD16_SW(9, 10, 11);

float frequency = 100.0;
float amplitude = 32768; // 50% of 16 bits

void setup()
{
Serial.begin(115200);
Serial.println();
Serial.println(__FILE__);
Serial.print("AD568X_LIB_VERSION: ");
Serial.println(AD568X_LIB_VERSION);

AD16_HW.begin();
AD16_SW.begin();

Serial.print("HWSPI: ");
Serial.println(AD16_HW.usesHWSPI());
Serial.print("HWSPI: ");
Serial.println(AD16_SW.usesHWSPI());
}


void loop()
{
float phase = fmod(micros() * (frequency * (TWO_PI * 1e-6)), TWO_PI);
float x = (1 + sin(phase)) * amplitude;
AD16_HW.setValue(x);
// Serial.println(x); // test
}


// -- END OF FILE --

0 comments on commit 22b7610

Please sign in to comment.