Latest version of my quadcopter controller with an LPC1768 and MPU9250.
Currently running on a custom PCB with 30.5 x 30.5mm mounts. There are also 2 PC apps that go with the software; one to set up the PID controller and one to balance the motors and props. If anyone is interested, send me a message and I'll upload them.
Diff: Filters/MAfilter.cpp
- Revision:
- 0:0929d3d566cf
- Child:
- 4:fab65ad01ab4
diff -r 000000000000 -r 0929d3d566cf Filters/MAfilter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Filters/MAfilter.cpp Mon Jul 09 16:31:40 2018 +0000 @@ -0,0 +1,29 @@ +#include "MAfilter.h" + +float MAfilter::run(float input) + { + for(i=1; i<200; i++) + { + filterbuff[i] = filterbuff[i-1]; + } + filterbuff[0] = input; + + for(i=0; i<200; i++) out = out + (filterbuff[i]/200); + + return out; + } + +float MAfilter10::run(float input) + { + for(i=1; i<10; i++) + { + filterbuff[i] = filterbuff[i-1]; + } + filterbuff[0] = input; + + out = 0; + for(i=0; i<10; i++) out = out + (filterbuff[i]*0.1); + + return out; + } +