This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef MOVING_AVERAGE_H | |
#define MOVING_AVERAGE_H | |
#define ROLLING_AVERAGE_WINDOW 6 | |
// Light Sensor (analogue read) - Moving average | |
int maverage_values[ROLLING_AVERAGE_WINDOW] = {0}; // all are zero as a start | |
int maverage_current_position = 0; | |
long maverage_current_sum = 0; | |
int maverage_sample_length = sizeof(maverage_values) / sizeof(maverage_values[0]); |