Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: QEI TextLCD mbed
ave.cpp
00001 #include "mbed.h" 00002 00003 #define KAZU 3 00004 00005 double ave(int num, double value) 00006 { 00007 static double sum[KAZU] = {0}; 00008 static double data[KAZU][5] = {{0}}; 00009 00010 sum[num] -= data[num][4]; 00011 sum[num] += value; 00012 data[num][4] = data[num][3]; 00013 data[num][3] = data[num][2]; 00014 data[num][2] = data[num][1]; 00015 data[num][1] = data[num][0]; 00016 data[num][0] = value; 00017 00018 return sum[num]/5; 00019 }
Generated on Tue Jul 19 2022 20:36:52 by
1.7.2