Hi all,
I am thinking about connecting a weight scale to Internet.
Today I was trying to use the ADC on PIN8 and PIN9.
It looks like there is a pretty consistent difference between PIN and PIN9.
I connect them to a point having Voltage 1.07V, and observed a 6% different.
Not sure if it is expected or not.
My code is like following, and the output value on server side is always around 1.06.
===================================
local interval_ms = 1000;
// read called every interval_ms
function read()
{
// read pin 9 value
local l_pin9 = hardware.pin9.read();
// read pin 8 value
local l_pin8 = hardware.pin8.read();
server.show(l_pin8*1.0/l_pin9);
// Schedule the next read
imp.wakeup(interval_ms/1000.0, read);
}
// Register with the server
imp.configure(“read ADC”, [], []);
// Configure pin 9 as an ADC Pin
hardware.pin9.configure(ANALOG_IN);
// Configure pin 8 as an ADC Pin
hardware.pin8.configure(ANALOG_IN);
// Start blinking
read();
// End of code.