示例#1
0
 def __init__(self, pins, name='', verbose=False):
     self.__name__ = name
     self.__verbose__ = verbose
     if self.__verbose__:
         print('Initializing UltraServo', self.__name__, '...', end=' ')
     self.__pins__ = General.LoadPins(['serv', 'trig', 'echo'], pins)
     self.__ultraservosetup__()
     if self.__verbose__:
         print('Done')
示例#2
0
 def __init__(self,pins,pud='OFF',name='',verbose=False):
     self.__name__ = name
     self.__verbose__ = verbose
     if self.__verbose__:
         print('Initializing InPin',self.__name__,'...',end=' ')
     self.__pins__ = General.LoadPins(['in'],pins)
     self.__inpinsetup__(pud)
     if self.__verbose__:
         print('Done')
示例#3
0
 def __init__(self, pins, freq=1023, dutycycle=100, on=False, name='', verbose=False):
     self.__name__ = name
     self.__verbose__ = verbose
     if self.__verbose__:
         print('Initializing PWMPin',self.__name__,'...',end=' ')
     self.__pins__ = General.LoadPins(['out'],pins)
     self.__pwmpinsetup__(on,freq,dutycycle)
     if self.__verbose__:
         print('Done')
示例#4
0
 def __init__(self,pins={},name='',verbose=False):
     self.__name__ = name
     self.__verbose__ = verbose
     if self.__verbose__:
         print('Initializing OutPin',self.__name__,'...',end=' ')
     self.__pins__ = General.LoadPins(['out'],pins)
     self.__outpinsetup__()
     if self.__verbose__:
         print('Done')
示例#5
0
 def __init__(self, pins, name='', verbose=False):
     self.__name__ = name
     self.__verbose__ = verbose
     if self.__verbose__:
         print('Initializing Ultrasonic Sensor',self.__name__,'...',end=' ')
     self.__pins__ = General.LoadPins(['trig','echo'],pins)
     self.__ultrasonicsensorsetup__()
     time.sleep(2)
     if self.__verbose__:
         print('Done')
示例#6
0
 def __init__(self, pins, name='', verbose=False) -> None:
     self.__name__ = name
     self.__verbose__ = verbose
     if self.__verbose__:
         print('Initializing Servo', self.__name__, '...', end=' ')
     self.__pins__ = General.LoadPins(['serv'], pins)
     self.__servosetup__()
     time.sleep(2)
     if self.__verbose__:
         print('Done')
示例#7
0
 def __init__(self,pins,function,risefall='RISING',pud='OFF',bouncetime=250,name='',verbose=False):
     self.__name__ = name
     self.__verbose__ = verbose
     if self.__verbose__:
         print('Initializing EventPin',self.__name__,'...',end=' ')
     self.__function__ = function
     self.__pins__ = General.LoadPins(['in'],pins)
     self.__eventpinsetup__(pud,risefall,bouncetime,function)
     if self.__verbose__:
         print('Done')
示例#8
0
 def __init__(self, pins, name='', verbose=False):
     self.__name__ = name  # name to refer to
     self.__verbose__ = verbose  # print each action
     if self.__verbose__:
         print('Initializing Multi-segment Display',
               self.__name__,
               '...',
               end=' ')
     self.__pins__ = General.LoadPins(
         ['h', 'g', 'f', 'e', 'd', 'c', 'b', 'a', '4', '3', '2', '1'], pins)
     self.__multisegmentdisplaysetup__()
     if self.__verbose__:
         print('Done')
示例#9
0
 def __init__(self,
              pins,
              direction=1,
              speed=50,
              on=True,
              name='',
              verbose=False) -> None:
     self.__name__ = name
     self.__verbose__ = verbose
     if self.__verbose__:
         print('Initializing DCMotor', self.__name__, '...', end=' ')
     self.__pins__ = General.LoadPins(['IA', 'IB'], pins)
     self.__dcmotorsetup__(direction, speed, on)
     if self.__verbose__:
         print('Done')