Rolfdegen
Well-known member
I am bad at arithmetic. That's why I need some support to draw filter curves on the display. I found an example and changed something. The curve looks like a low pass with a strong response. I need the waveform for some filters such as LowPass, BandPass and HighPass.
My example of drawing a LowPass
Draw on Display
Thanks for help
My example of drawing a LowPass
Code:
//*************************************************************************
// draw_filter_curves
//*************************************************************************
void draw_filter_curves (void)
{
/* Original calculation
uint8_t x = 80;
uint8_t y = 50;
uint8_t cx = 80;
uint8_t cy = 80;
int rx = 10;
int ry = 10;
for (float i = 0; i < 1 * pi; i += .05) {
x = cx + sin(i) * rx;
y = cy + cos(i) * ry;
disp.drawPixel(x, y, ST7735_WHITE);
}
*/
// my calculation for an LowPass with strong resonance
uint8_t x = 80;
uint8_t y = 50;
uint8_t cx = 80;
uint8_t cy = 80;
int rx = -10;
int ry = -15;
for (float i = 0; i < 1 * pi; i += .05) {
y = cx + sin(i) * ry;
x = cy + log(i) * rx;
disp.drawPixel(160 - x, y, ST7735_WHITE);
}
}
Draw on Display
Thanks for help