1
TinyDuino Processors & TinyShields / Re: Battery charge status/power remaining
« on: August 12, 2016, 01:03:08 AM »I have a function we use to grab VCC on the AVR platform-Does the TinyScreen+ (ARM platform) have a similar function?Code: [Select]int getVCClevel(){
//http://forum.arduino.cc/index.php?topic=133907.0
const long InternalReferenceVoltage = 1100L;
ADMUX = (0<<REFS1) | (1<<REFS0) | (0<<ADLAR) | (1<<MUX3) | (1<<MUX2) | (1<<MUX1) | (0<<MUX0);
delay(1);
ADCSRA |= _BV( ADSC );
while( ( (ADCSRA & (1<<ADSC)) != 0 ) );
int result = (((InternalReferenceVoltage * 1024L) / ADC) + 5L) / 10L;
return result;//this should be in hundredths of a volt
}
You can use this and a general lithium ion discharge curve to guess approximate charge level.
Thanks,
Ben