2020-11-27 05:16:22 -05:00
|
|
|
//
|
|
|
|
// FILE: functionGeneratorDuoPlot.ino
|
|
|
|
// AUTHOR: Rob Tillaart
|
|
|
|
// PURPOSE: demo function generators
|
|
|
|
// DATE: 2020-06-10
|
|
|
|
// URL: https://github.com/RobTillaart/FunctionGenerator
|
|
|
|
//
|
2023-03-26 04:32:34 -04:00
|
|
|
// use a Serial plotter to show the data
|
2020-11-27 05:16:22 -05:00
|
|
|
|
|
|
|
|
|
|
|
#include "functionGenerator.h"
|
|
|
|
|
|
|
|
funcgen gen1;
|
|
|
|
funcgen gen2;
|
|
|
|
|
2021-11-02 06:27:01 -04:00
|
|
|
|
2020-11-27 05:16:22 -05:00
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
Serial.begin(115200);
|
2023-03-26 04:32:34 -04:00
|
|
|
// Serial.println();
|
|
|
|
// Serial.println(__FILE__);
|
|
|
|
// Serial.print("FUNCTIONGENERATOR_LIB_VERSION: ");
|
2020-11-27 05:16:22 -05:00
|
|
|
// Serial.println(FUNCTIONGENERATOR_LIB_VERSION);
|
|
|
|
|
|
|
|
gen1.setFrequency(13);
|
|
|
|
gen1.setAmplitude(50);
|
|
|
|
gen1.setPhase(0);
|
|
|
|
gen1.setYShift(0);
|
|
|
|
|
|
|
|
gen2.setFrequency(17);
|
|
|
|
gen2.setAmplitude(25);
|
|
|
|
gen2.setPhase(0.25);
|
|
|
|
gen2.setYShift(25);
|
|
|
|
}
|
|
|
|
|
2021-11-02 06:27:01 -04:00
|
|
|
|
2020-11-27 05:16:22 -05:00
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
float t = millis() * 0.001;
|
|
|
|
float x = gen1.sinus(t);
|
|
|
|
float y = gen2.sinus(t);
|
|
|
|
Serial.print(x);
|
|
|
|
Serial.print("\t");
|
|
|
|
Serial.print(y);
|
|
|
|
Serial.print("\t");
|
|
|
|
Serial.print(x + y);
|
|
|
|
Serial.println();
|
|
|
|
}
|
|
|
|
|
2021-11-02 06:27:01 -04:00
|
|
|
|
2023-03-26 04:32:34 -04:00
|
|
|
// -- END OF FILE --
|
2021-11-02 06:27:01 -04:00
|
|
|
|