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:
pinMode(D28,'analog');
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 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.
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:
pinMode(D28,'analog');
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.