#!/usr/bin/python3 """ GPIO handling handling GPIO's """ import RPi.GPIO as gpio import names import logging_ global logger logger = logging_.create_logger(__name__) logger.debug('logging initialised') class gpio_handling(): #--------------------------------------------------------- def __init__(): pass #--------------------------------------------------------- # Function Setup GPIO def setupGPIO(): """ setting up GPIO's (boardmode, in/out) """ global logger logstring = 'setupGPIO()' logger.debug(logstring) gpio.setwarnings(False)
class Loopcounter(): def __init__(self): self.reset() def reset(self): self.loopcount = 0 def increase(self): self.loopcount += 1 def get_value(self): return self.loopcount loopcounter = Loopcounter() logger = logging_.create_logger('main') logger.debug('logging initialised') # initialise system try: gpio_handling.setGPIO_boardmode() gpio_handling.setupGPIO() gpio_handling.defaultGPIO() loop.do_mainloop() except KeyboardInterrupt: logger.warning('KeyboardInterrupt') pass except Exception as e: