Turn MIDI data into stepper motor music!
Project tutorial by Jonathan Kayne
I used a Raspberry Pi 2 to make a mini data acquisition system that fits inside of a lunchbox.
Project showcase by Josh Makatura
Eliminate the need for a hanging tennis ball with this ultrasonic distance sensor & Arduino controlled stop light for perfect parking.
Project tutorial by Team Stuart Mace
Here is a filter for you.
add a new variable
add a constant, or variable with your filter.
double filtermetric = 15;
add this filter after you you get your reading in degrees, but before you display it.
displayx = (displayx*filtermetric+x)/(filtermetric+1);
change what you display from "x" to "displayx"
you can do the filtering anywhere you like. But, the filter needs to be declared as double, not an int, as you may experience overflow. filterconstant times the displayx could exceed the max value for an "int".
Start with a filtermetric of 15. The higher the number, the more filtering. Usually you can go up to 64 before it gets too filtered. beyond that may or may not help.
This filter takes the new result and adds it to the old result with a heavy weighting. Then it divides to get you back to the original magnitude.
This filter works great and only requires one variable. You will want your loop to operate as fast as possible so the filter can get as much data as possible.
Let me know how it goes.
Or connect with your social account:
New here? Create an account