I 've added this lines from Fabio's Code to make the Pressure-readings smoother.
#define MOVAVG_SIZE 32
float movavg_buff[MOVAVG_SIZE];
int movavg_i=0;
uint32_t D1 = 0;
uint32_t D2 = 0;
....
Wire.begin();
Serial.begin(9600); //9600 changed 'cos of timing?
delay(100);
initial(ADDRESS);
//populate movavg_buff before starting loop
for(int i=0; i<MOVAVG_SIZE; i++) {
movavg_buff = Pressure;
- }[/color]*
Serial.print(" Actual TEMP= "); - Serial.print(Temperature);*
- Serial.print(" Actual PRESSURE= ");*
- pushAvg(Pressure);*
- Serial.print(getAvg(movavg_buff, MOVAVG_SIZE));*
void pushAvg (float val) { - movavg_buff[movavg_i] = val;*
- movavg_i = (movavg_i + 1) % MOVAVG_SIZE;*
}
float getAvg(float * buff,int size) { - float sum = 0.0;*
- for(int i=0; i<size; i++) {*
_ sum += buff*;_
_ }_
_ return sum /size;_
_}_
_[/color]_
long getVal(int address, byte code)
_....*_