Problem with new AnalogIn

02 Dec 2009

I am revisiting my early stuff (Where_is_up) with a view to building an app round it. To confirm it still worked, I recompiled and reloaded using the original library  and it works as expected (more or less as z is 1.2g). I created a new program and copied the original code into it and compiled with the new library. Naturally it was rejected because id the non-"p" pin id. Corrected that and it told me that AnalogIn didn't do a "read_v()" any more, so I changed that to "read()" and it compiled ok. However the readout on the screen is totally wrong as x and y are both -3.44g and z is -3.01g.  Has the scaling of AnalogIn changed since the early days?

Pip

02 Dec 2009

I spotted that the new AnalogIn is scaled 0.0 to 1.0 for 0V to 3.3V and the old "read_v()" was obviously in volts.  The axis scaling has changed (empirically) from "read_v()-1.662)*3" to "read()-0.52)*10" to get the same displayed values from the ADXL330. Nice gotcha!

Pip