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:
But - you say it's inverted. No problem:
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, powered by microcosm.
Report a problem