Rename folder

This commit is contained in:
Konstantin Lampalzer 2021-01-16 02:10:40 +01:00
parent 651713c081
commit daef7c97e4
No known key found for this signature in database
GPG key ID: 9A60A522835A2AD9
11 changed files with 5 additions and 5 deletions

24
compLib/Battery.py Normal file
View file

@ -0,0 +1,24 @@
from compLib.ADC import ADC
BATTERY_CHANNEL = 2
BATTERY_COUNT = 2
BATTERY_MULTIPLIER = 3
BATTERY_MIN_VOLTAGE = 3.6
BATTERY_MAX_VOLTAGE = 4.1
adc = ADC()
class Battery(object):
"""Used to interact with the battery
"""
@staticmethod
def percent() -> int:
"""Get battery percentage
:return: Percentage between 0 and 100
:rtype: int
"""
voltage = adc.read(BATTERY_CHANNEL) * BATTERY_MULTIPLIER
return int((voltage - BATTERY_MIN_VOLTAGE) / BATTERY_MAX_VOLTAGE * 100)