That’s a bug really, isn’t it? A 12-bit ADC “pretending” to be a 16-bit one (which is what it does for future expansion, in case we ever upgrade the imp internals with a part that has a real 16-bit ADC) shouldn’t be (n<<4), it should be (n<<4) | (n>>8) so that the maximum reading remains 65535.
how exactly would you implement a read from an analog sensor? very new and a bit unclear by reading the documentation. explanation greatly appreciated!
If you're pretty confident in your power supply then you simply configure the pin as ANALOG_IN then read it to get an integer between 0 (corresponding to 0V) and 65535 (corresponding to 3.3V).
hardware.pin1.configure(ANALOG_IN);
result = hardware.pin1.read();
If you're running on an unstable power supply you can call hardware.voltage to read the supply rail and then scale your pin result appropriately. Most designs shouldn't be affected by this unless you need to be super accurate (and it's not a super accurate ADC anyway).
I plan to post a Hannah potentiometer example next week which will demonstrate this in practice, including the scaling.