Maximum count of analog in

I am getting unexpected readings on both pin2 and pin5 as analog inputs on an imp001 (I only have one … waiting on two others to arrive).

When I short pin 5 to 3V3G I get these readings with the associated code. Looks like the maximum count is 16,383 and not 65,535.

Anyone else seeing the same?

Thank you - Gustavo

LOG LISTING:

|2018-01-12 19:40:29 -08:00|[Status]|Agent restarted: reload.|
|2018-01-12 19:40:30 -08:00|[Status]|Downloading new code; 0.62% program storage used|
|2018-01-12 19:40:30 -08:00|[Device]|vin: 3.32 therm.read: 11938.00|
|2018-01-12 19:40:30 -08:00|[Device]|vin: 3.32 therm.read: 13123.00|
|2018-01-12 19:40:30 -08:00|[Device]|end therm.read: 13971.00|
|2018-01-12 19:40:35 -08:00|[Device]|vin: 3.32 therm.read: 12210.00|
|2018-01-12 19:40:35 -08:00|[Device]|vin: 3.32 therm.read: 13203.00|
|2018-01-12 19:40:35 -08:00|[Device]|end therm.read: 13875.00|

DEVICE CODE:

// Assign hardware.pin5 to a global variable, therm
therm <- hardware.pin5;

// Configure pin5/therm for analog input
therm.configure(ANALOG_IN);

function getTemp() {
local vin = hardware.voltage();
server.log(format(“vin: %.2f therm.read: %.2f”, vin, therm.read()));
server.log(format(“vin: %.2f therm.read: %.2f”, vin, therm.read()));
server.log(format(“end therm.read: %.2f”, therm.read()));

return;

}

function poll() {
// Get and log the temperature in both scales
getTemp();

// Wake in 5 seconds and read the value again:
imp.wakeup(5.0, poll);

}

Found the schematics for the impExplorer Kit to learn that 3.3v to the Grove headers is gated by pin1.
Added the following line to get things working properly. Now reading a full 65535.

hardware.pin1.configure(DIGITAL_OUT, 1);

LOG LISTING now:

|2018-01-13 08:28:26 -08:00|[Status]|Downloading new code; 1.49% program storage used|
|2018-01-13 08:28:27 -08:00|[Device]|vin: 3.31 therm.read: 65535.00|
|2018-01-13 08:28:27 -08:00|[Device]|vin: 3.31 therm.read: 65535.00|
|2018-01-13 08:28:27 -08:00|[Device]|end therm.read: 65535.00|