Archive for 20 Dec 2010

Tilt sensor (Part 4)

Part 1, 2, 3, 4, 5, 6, 7, 8, 9 Let’s for coding now. Firstly we need to set the analog reference to Internal as follows analogReference(INTERNAL); and build a simple acquiring / converting routine double analogReadMv(uint8_t channel) { double analogValue = 0; for (uint8_t _sample = 0; _sample < _samples; _sample++) { analogValue += analogRead(vAdcPin[channel]); /* Sum measurements */ } analogValue /= _samples; […]