b15f/control/examples/pegel/main.cpp

44 lines
803 B
C++
Raw Normal View History

2019-03-26 09:57:01 +01:00
#include <iostream>
2019-03-29 11:12:31 +01:00
#include <cmath>
2019-05-15 15:39:16 +02:00
#include <b15f/b15f.h>
#include <b15f/plottyfile.h>
2019-03-26 09:57:01 +01:00
2019-03-28 11:11:19 +01:00
2019-05-15 16:35:47 +02:00
int main()
2019-03-26 09:57:01 +01:00
{
2019-04-03 09:34:22 +02:00
2019-03-26 09:57:01 +01:00
B15F& drv = B15F::getInstance();
2019-03-29 08:32:11 +01:00
PlottyFile pf;
2019-03-27 10:33:16 +01:00
2019-03-28 11:11:19 +01:00
uint16_t ba[1024];
uint16_t bb[1024];
2019-04-03 08:40:14 +02:00
const uint16_t sample_count = 1024;
const uint16_t delta = 1;
2019-03-28 11:11:19 +01:00
pf.setUnitX("V");
2019-05-15 16:35:47 +02:00
pf.setUnitY("V");
2019-03-28 11:11:19 +01:00
pf.setUnitPara("V");
2019-05-15 16:35:47 +02:00
pf.setDescX("U_{OUT}");
pf.setDescY("U_{IN}");
pf.setDescPara("");
2019-03-28 11:11:19 +01:00
pf.setRefX(5);
2019-05-15 16:35:47 +02:00
pf.setRefY(5);
pf.setParaFirstCurve(0);
pf.setParaStepWidth(0);
2019-03-28 11:11:19 +01:00
uint8_t curve = 0;
2019-04-03 09:34:22 +02:00
2019-05-15 16:35:47 +02:00
drv.analogSequence(0, &ba[0], 0, 1, &bb[0], 0, 0, delta, sample_count);
for(uint16_t x = 0; x < sample_count * delta; x += delta)
{
pf.addDot(Dot(x, ba[x], curve));
}
2019-03-29 08:32:11 +01:00
// speichern und plotty starten
pf.writeToFile("test_plot");
pf.startPlotty("test_plot");
2019-03-28 11:11:19 +01:00
}