Your best bet is to take many measurements, and to then take the average of those. For instance:
var sum = 0; var n = 100; for (var i=0;i<n;i++) sum+=analogRead(INPUT_PIN); var result = sum/n;
There are other ways you can do this as well, for instance you can median filter:
var arr = new Uint8Array(100); for (var i=0;i<arr.length;i++) arr[i]=analogRead(INPUT_PIN); arr.sort(); result = arr[arr.length/2];
@Gordon started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Your best bet is to take many measurements, and to then take the average of those. For instance:
There are other ways you can do this as well, for instance you can median filter: