I see two pots on that board - it's not clear exactly what they do from their half-sentence descriptions of them though.
I suspect that one of them adjusts the trip point of Dout (ie, if reading is below a specified value Dout is low else it's high, or something like that)
Espruino doesn't have "float" declaration - js doesn't make you declare types.
Espruino's analogRead() returns a floating point number between 0 and 1 (not a number from 0 to 1023 like Arduino).
For Espruino, the equivilent of that line would be:
var co2=analogRead(pin);
var ppm=400+co2*(10000-400)
But - you say it's inverted. No problem:
var co2=1-analogRead(pin);
var ppm=400+co2*(10000-400)
I do not by any means expect that calculation (nor the Arduino one) to yield a vaguely accurate number for ppm though, because that line (the one you posted and I converted to Espruino) assumes that 10000 ppm and 400ppm are at the far ends of the scale, which is probably not the case.
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.
I see two pots on that board - it's not clear exactly what they do from their half-sentence descriptions of them though.
I suspect that one of them adjusts the trip point of Dout (ie, if reading is below a specified value Dout is low else it's high, or something like that)
Espruino doesn't have "float" declaration - js doesn't make you declare types.
Espruino's analogRead() returns a floating point number between 0 and 1 (not a number from 0 to 1023 like Arduino).
For Espruino, the equivilent of that line would be:
var co2=analogRead(pin);
var ppm=400+co2*(10000-400)
But - you say it's inverted. No problem:
var co2=1-analogRead(pin);
var ppm=400+co2*(10000-400)
I do not by any means expect that calculation (nor the Arduino one) to yield a vaguely accurate number for ppm though, because that line (the one you posted and I converted to Espruino) assumes that 10000 ppm and 400ppm are at the far ends of the scale, which is probably not the case.