Teensy 3.1: Low, High and/or Band-Pass Filters

Status
Not open for further replies.

Chopsticks

Active member
Hi there!

While I was measuring with noisy ECG signals, I need something that take cares of filtering the measured signals.

I came across the following filter library: http://jeroendoggen.github.io/Arduino-signal-filtering-library/
It seems pretty easy to create a filter with this... It sounds really nice, it generates some code, and we need to change the libraries with the generated code? Anyhow... after editing my library files with the generated code I encountered several errors:

such like:
Code:
This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
Arduino: 1.0.5-r2 (Windows NT (unknown)), Board: "Teensy 3.1"
In file included from newFilter.ino:4:0:
C:\Arduino\libraries\Filter/newFilter.h:12:10: error: ISO C++ forbids declaration of 'filter' with no type [-fpermissive]
newFilter:6: error: cannot declare variable 'Filter' to be of abstract type 'newFilter'
In file included from newFilter.ino:4:0:
C:\Arduino\libraries\Filter/newFilter.h:9:7: note:   because the following virtual functions are pure within 'newFilter':
In file included from C:\Arduino\libraries\Filter/newFilter.h:7:0,
                 from newFilter.ino:4:
C:\Arduino\libraries\Filter/Filter.h:20:17: note: 	virtual int Filter::run(int)
newFilter.ino: In function 'void setup()':
newFilter:14: error: 'class newFilter' has no member named 'begin'
In file included from C:\Arduino\libraries\Filter/newFilter.h:7:0,
                 from newFilter.ino:4:
C:\Arduino\libraries\Filter/Filter.h: In function 'void loop()':
C:\Arduino\libraries\Filter/Filter.h:20:17: error: 'virtual int Filter::run(int)' is private
newFilter:20: error: within this context

Anyone knows what's causing this? Or how to implement the generated code into a new library file? It's not very clear to me what i actually need to change?

At this moment i have edited 'newFilter' to this:
Code:
// Arduino Signal Filtering Library
// Copyright 2012-2013 Jeroen Doggen (jeroendoggen@gmail.com)

#ifndef newFilter_h
#define newFilter_h
#include <Arduino.h>
#include <Filter.h>

class newFilter : public Filter
{
	public:
		newFilter()
		{
			for(int i=0; i <= 10; i++)
				v[i]=0.0;
		}
	private:
		float v[11];
	public:
		float step(float x) //class II 
		{
			v[0] = v[1];
			v[1] = v[2];
			v[2] = v[3];
			v[3] = v[4];
			v[4] = v[5];
			v[5] = v[6];
			v[6] = v[7];
			v[7] = v[8];
			v[8] = v[9];
			v[9] = v[10];
			v[10] = (2.766929730595e-3 * x)
				 + ( -0.0808708884 * v[0])
				 + (  0.8744889062 * v[1])
				 + ( -4.4332135268 * v[2])
				 + ( 13.8481537992 * v[3])
				 + (-29.4860113999 * v[4])
				 + ( 44.7006874561 * v[5])
				 + (-48.8754142978 * v[6])
				 + ( 38.0698269619 * v[7])
				 + (-20.2086326211 * v[8])
				 + (  6.5906492691 * v[9]);
			return 
				 (v[10] - v[0])
				+5 * (v[2] - v[8])
				+10 * (v[6] - v[4]);
		}
};
#endif
 
Last edited:
Status
Not open for further replies.
Back
Top