Public projects 0

John R McAlpine V Mac has no public projects.

Arduino MIDI Stepper Synth

Project tutorial by Jonathan Kayne

  • 21,733 views
  • 23 comments
  • 65 respects

Star Wars Lunch Box Data Aquisition

Project showcase by Josh Makatura

  • 7,297 views
  • 1 comment
  • 26 respects

The "Tennis Ball" Garage Stop Light

Project tutorial by Team Stuart Mace

  • 10,524 views
  • 2 comments
  • 37 respects

Comments 1

  • Golf Grip alignment tool over 3 years ago

    Hi Hunter,
    Neat project.
    Here is a filter for you.

    add a new variable
    double displayx;

    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.

Add projectSign up / Login