/* MS561101BA_movaverage.pde - Reads from the sensors and outputs a moving averaged pressure reading Copyright (C) 2011 Fabio Varesano Development of this code has been supported by the Department of Computer Science, Universita' degli Studi di Torino, Italy within the Piemonte Project http://www.piemonte.di.unito.it/ This program is free software: you can redistribute it and/or modify it under the terms of the version 3 GNU General Public License as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ //#define DEBUG_V #include //#include #include #define MOVAVG_SIZE 32 MS561101BA baro = MS561101BA(); float movavg_buff[MOVAVG_SIZE]; int movavg_i=0; void setup() { Wire.begin(); Serial.begin(9600); delay(1000); // Suppose that the CSB pin is connected to GND. // You'll have to check this on your breakout schematics baro.init(MS561101BA_ADDR_CSB_LOW); delay(100); // populate movavg_buff before starting loop for(int i=0; i