Latest version of my quadcopter controller with an LPC1768 and MPU9250.

Dependencies:   mbed

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.

Filters/MAfilter.cpp

Committer:
Anaesthetix
Date:
2018-07-09
Revision:
0:0929d3d566cf
Child:
4:fab65ad01ab4

File content as of revision 0:0929d3d566cf:

#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;
		}