You'll need to provide a resistor divider on port bit D28 (which is the only analog input) to scale the voltage between 0-3.3V. Then:
value = analogRead(D28) * scale_factor;
You'll have to figure out the scale factor yourself - 3.3V is full scale which is a value of 1. For example, I'm using a voltage divider to read a 12V battery with a 39k and 10k resistor. The scale factor is 16.21.
© Espruino, powered by microcosm.
Report a problem