craigcurtin
Senior Member
Guys,
I have a Picaxe 40x1 that i wish to use to display a fuel level in my car.
I have a 10-180ohms sender that i have hooked in and running and can get sensible values back into the picaxe
I have a routine from another project (heating control for my house) that takes a reading once per minute, shuffles out the oldest reading (keep 5 samples in total) and then averages those numbers to produce a crude moving average.
I wish to do something similar with the "Fuel Gauge". i.e.
1) take a reading each minute,
2) check it is sensible (lets say within 5% of the moving average) if so
3) shuffle all the entries down the list by one, drop the oldest and add this new one to slot 1
4) Add them together and then average
I am OK on all of this except for the maths to check if the moving average is within 5% of the value just read - can anyone give me some pointers on how they would tackle the maths side please ?
regards
Craig
I have a Picaxe 40x1 that i wish to use to display a fuel level in my car.
I have a 10-180ohms sender that i have hooked in and running and can get sensible values back into the picaxe
I have a routine from another project (heating control for my house) that takes a reading once per minute, shuffles out the oldest reading (keep 5 samples in total) and then averages those numbers to produce a crude moving average.
I wish to do something similar with the "Fuel Gauge". i.e.
1) take a reading each minute,
2) check it is sensible (lets say within 5% of the moving average) if so
3) shuffle all the entries down the list by one, drop the oldest and add this new one to slot 1
4) Add them together and then average
I am OK on all of this except for the maths to check if the moving average is within 5% of the value just read - can anyone give me some pointers on how they would tackle the maths side please ?
regards
Craig