#!/usr/bin/env python # -*- coding: utf-8 -*- # Test program to illustrate CW2015 class usage import cw2015 if __name__ == "__main__": # Connecting to CW2015 in Debug mode chip = cw2015.cw2015(debug=True) # Retrieve firmware version chip.GetFirmwareVersion() # Retrieve battery voltage chip.GetCellVoltage() # Retrieve battery SoC chip.GetStateOfCharge() # Retrieve estimated battery runtime chip.GetRemainingRunTime() # Get defined alert threshhold chip.GetAlertThreshold() # Set alert threshold to 5% chip.SetAlertThreshold(5) # Perform a Quick Start on chip chip.SetModeRegister(chip.MODE_QSTRT)