Every brace of seconds, the software samples the two analog inputs, calculates the allegation accepted and array voltage, and shows the voltage on the red LED and the allegation accepted on the blooming LED. The voltage is apparent in units of 0.1V appliance three decimal digits, and the accepted is apparent in units of 10mA appliance two decimal digits. Anniversary chiffre is represented by a cardinal of abbreviate flashes agnate to the amount of the digit. A aught is represented by a distinct best flash. When the allegation accepted is beneath 10mA (after rounding) or negative, the blooming LED is not angry on at all.
I use 4 times oversampling to get an 11-bit result, afterward the address declared in the Atmel appliance agenda AVR121. I'm not abiding if there is abundant babble on the inputs to absolutely access the resolution, but it will not aching either. The raw A/D account is adapted to a voltage appliance a abstracted brace of offset/gain constants for anniversary input. These constants are acquired from the arrangement abstracts stored in the EEPROM.
To save power, all delays are implemented by active one or added beddy-bye instructions which account the CPU to abandoned until the abutting timer interrupt. The arrest abundance is 100 Hz, so anniversary beddy-bye pauses up to 10 mS.