From 22b761096b48c0da5b3b364889188921e36d3410 Mon Sep 17 00:00:00 2001 From: Rob Tillaart Date: Tue, 19 Sep 2023 20:02:28 +0200 Subject: [PATCH] add examples --- examples/AD568X_sinus/AD568X_sinus.ino | 42 ++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 examples/AD568X_sinus/AD568X_sinus.ino diff --git a/examples/AD568X_sinus/AD568X_sinus.ino b/examples/AD568X_sinus/AD568X_sinus.ino new file mode 100644 index 0000000..3630638 --- /dev/null +++ b/examples/AD568X_sinus/AD568X_sinus.ino @@ -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 --