public float getVoltage ( ) { // Range mapping from http://stackoverflow.com/a/7506169/254187 float inMin = 0 ; float inMax = 100 ; float outMin = ( float ) 2.0 ; float outMax = ( float ) 3.7 ; float x = this . percentage ; return ( x - inMin ) * ( outMax - outMin ) / ( inMax - inMin ) + outMin ; }
Get the battery level in volts .