7 // Initialize the digital pin as an output.
8 // Pin 13 has an LED connected on most Arduino boards
12 Timer1.initialize(5000);
13 Timer1.attachInterrupt( timerIsr ); // attach the service routine here
19 // TODO: Put your regular (non-ISR) logic here
22 /// --------------------------
23 /// Custom ISR Timer Routine
24 /// --------------------------
27 digitalWrite(12, HIGH);
28 int raw = analogRead(A0);
29 double input = (double)raw;
30 double filtered = filterStep(input);
33 Serial.println(filtered);
34 digitalWrite(12, LOW);
37 // Sample f 200Hz, band stop 49-50Hz
38 // http://www.schwietering.com/jayduino/filtuino/index.php?characteristic=bu&passmode=bs&order=3&usesr=usesr&sr=200&frequencyLow=47¬eLow=&frequencyHigh=53¬eHigh=&pw=pw&calctype=double&run=Send
39 // Band stop butterworth filter order=3 alpha1=0.235 alpha2=0.265
42 for(int i=0; i <= 10; i++)
49 double filterStep(double x)
57 v[6] = (8.27971295622e-1 * x)
58 + ( -0.6855359773 * v[0])
59 + ( -0.0000000000 * v[1])
60 + ( -2.3146825811 * v[2])
61 + ( -0.0000000000 * v[3])
62 + ( -2.6235518066 * v[4])
63 + ( -0.0000000000 * v[5]);