Python RPi.GPIO.PUD_DOWN Examples

The following are 30 code examples of RPi.GPIO.PUD_DOWN(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module RPi.GPIO , or try the search function .
Example #1
Source File: teachable.py    From project-teachable with Apache License 2.0 7 votes vote down vote up
def __init__(self):
    # Only for RPi3: set GPIOs to pulldown
    global rpigpio
    import RPi.GPIO as rpigpio
    rpigpio.setmode(rpigpio.BCM)

    # Layout of GPIOs for Raspberry demo
    self._buttons = [16 , 6 , 5 , 24, 27]
    self._LEDs = [20, 13, 12, 25, 22]

    # Initialize them all
    for pin in self._buttons:
      rpigpio.setup(pin, rpigpio.IN, pull_up_down=rpigpio.PUD_DOWN)
    for pin in self._LEDs:
      rpigpio.setwarnings(False)
      rpigpio.setup(pin, rpigpio.OUT)
    super(UI_Raspberry, self).__init__() 
Example #2
Source File: pin.py    From Adafruit_Blinka with MIT License 6 votes vote down vote up
def init(self, mode=IN, pull=None):
        """Initialize the Pin"""
        if mode is not None:
            if mode == self.IN:
                self._mode = self.IN
                GPIO.setup(self.id, GPIO.IN)
            elif mode == self.OUT:
                self._mode = self.OUT
                GPIO.setup(self.id, GPIO.OUT)
            else:
                raise RuntimeError("Invalid mode for pin: %s" % self.id)
        if pull is not None:
            if self._mode != self.IN:
                raise RuntimeError("Cannot set pull resistor on output")
            if pull == self.PULL_UP:
                GPIO.setup(self.id, GPIO.IN, pull_up_down=GPIO.PUD_UP)
            elif pull == self.PULL_DOWN:
                GPIO.setup(self.id, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
            else:
                raise RuntimeError("Invalid pull for pin: %s" % self.id) 
Example #3
Source File: ultrasonic-distance.py    From raspberrypi-examples with MIT License 5 votes vote down vote up
def setup():
	GPIO.setwarnings(False)
	GPIO.setmode(GPIO.BCM)
	GPIO.setup(pecho, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
	GPIO.setup(ptrig, GPIO.OUT)
	GPIO.output(ptrig, 0) 
Example #4
Source File: gpio.py    From GPIOnext with MIT License 5 votes vote down vote up
def setupGPIO( args ):
	global pins
	GPIO.setmode(GPIO.BOARD)
	GPIO.setwarnings(args.dev)
	pull = GPIO.PUD_UP 
	if args.pulldown:
		pull = GPIO.PUD_DOWN
	for pinNumber in args.pins:
		if pull == GPIO.PUD_DOWN:
			if pinNumber in (3,5):
				print("Can't set I2C pins to pulldown! Skipping...")
				continue
		pins.append( pin(pinNumber, pull, args) ) 
Example #5
Source File: rpi.py    From pingo-py with MIT License 5 votes vote down vote up
def _set_digital_mode(self, pin, mode):
        # Cleans previous PWM mode
        if pin.mode == pingo.PWM:
            if int(pin.location) in self._rpi_pwm:
                self._rpi_pwm[int(pin.location)].stop()
                del self._rpi_pwm[int(pin.location)]
        # Sets up new modes
        if mode == pingo.IN:
            GPIO.setup(int(pin.gpio_id), GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
        elif mode == pingo.OUT:
            GPIO.setup(int(pin.gpio_id), GPIO.OUT) 
Example #6
Source File: IR-Sensor.py    From GassistPi with GNU General Public License v3.0 5 votes vote down vote up
def setup():
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) 
Example #7
Source File: interrupt.py    From alertR with GNU Affero General Public License v3.0 5 votes vote down vote up
def initializeSensor(self) -> bool:
        self.hasLatestData = False
        self.changeState = True

        # get the value for the setting if the gpio is pulled up or down
        if self.pulledUpOrDown == 0:
            pulledUpOrDown = GPIO.PUD_DOWN
        elif self.pulledUpOrDown == 1:
            pulledUpOrDown = GPIO.PUD_UP
        else:
            logging.critical("[%s]: Value for pulled up or down setting not known." % self.fileName)
            return False

        # configure gpio pin and get initial state
        GPIO.setmode(GPIO.BOARD)
        GPIO.setup(self.gpioPin, GPIO.IN, pull_up_down=pulledUpOrDown)

        # set initial state to not triggered
        self.state = 1 - self.triggerState
        self._internalState = 1 - self.triggerState

        # set edge detection
        if self.edge == 0:
            GPIO.add_event_detect(self.gpioPin,
                                  GPIO.FALLING,
                                  callback=self._interruptCallback)
        elif self.edge == 1:
            GPIO.add_event_detect(self.gpioPin,
                                  GPIO.RISING,
                                  callback=self._interruptCallback)
        else:
            logging.critical("[%s]: Value for edge detection not known." % self.fileName)
            return False

        return True 
Example #8
Source File: RPiGPIOPin.py    From calvin-base with Apache License 2.0 5 votes vote down vote up
def init(self, pin, direction, pull=None, edge=None, bouncetime=None, **kwargs):
        self.values = []
        self.pin = pin
        self.direction = direction
        self.edge = edge
        GPIO.setmode(GPIO.BCM)
        if direction == "IN":
            if pull is not None:
                if pull == "UP":
                    GPIO.setup(pin, GPIO.IN, GPIO.PUD_UP)
                elif pull == "DOWN":
                    GPIO.setup(pin, GPIO.IN, GPIO.PUD_DOWN)
                else:
                    raise Exception("Uknown pull configuration")
            else:
                GPIO.setup(pin, GPIO.IN)

            if edge is not None:
                if edge == "RISING":
                    GPIO.add_event_detect(self.pin, GPIO.RISING, callback=self.edge_cb, bouncetime=bouncetime)
                elif edge == "FALLING":
                    GPIO.add_event_detect(self.pin, GPIO.FALLING, callback=self.edge_cb, bouncetime=bouncetime)
                elif edge == "BOTH":
                    GPIO.add_event_detect(self.pin, GPIO.BOTH, callback=self.edge_cb, bouncetime=bouncetime)
                else:
                    raise Exception("Unknown edge configuration")
        elif direction == "OUT":
            GPIO.setup(pin, GPIO.OUT)
        else:
            raise Exception("Unknown direction") 
Example #9
Source File: board_config.py    From pySX127x with GNU Affero General Public License v3.0 5 votes vote down vote up
def setup():
        """ Configure the Raspberry GPIOs
        :rtype : None
        """
        GPIO.setmode(GPIO.BCM)
        # LED
        GPIO.setup(BOARD.LED, GPIO.OUT)
        GPIO.output(BOARD.LED, 0)
        # switch
        GPIO.setup(BOARD.SWITCH, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) 
        # DIOx
        for gpio_pin in [BOARD.DIO0, BOARD.DIO1, BOARD.DIO2, BOARD.DIO3]:
            GPIO.setup(gpio_pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
        # blink 2 times to signal the board is set up
        BOARD.blink(.1, 2) 
Example #10
Source File: nanodac_lirc.py    From Nanomesher_NanoSound with Apache License 2.0 5 votes vote down vote up
def setup():
    GPIO.setmode(GPIO.BOARD)  # Numbers GPIOs by physical location
    GPIO.setup(11, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) 
Example #11
Source File: light.py    From nhl_goal_light with GNU General Public License v3.0 5 votes vote down vote up
def setup():
    """ Function to setup raspberry pi GPIO mode and warnings. PIN 7 OUT and PIN 11 IN """

    # Setup GPIO on raspberry pi
    GPIO.setmode(GPIO.BOARD)
    GPIO.setwarnings(False)
    GPIO.setup(7, GPIO.OUT, initial=GPIO.LOW) # Tell the program you want to use pin number 7 as output. Relay is ACTIVE LOW, so OFF is HIGH
    GPIO.setup(11, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)  # Set GPIO 11 as a PULL DOWN switch
    GPIO.add_event_detect(11, GPIO.RISING, activate_goal_light, 5000) 
Example #12
Source File: control.py    From mudpi-core with MIT License 5 votes vote down vote up
def __init__(self, pin, name='Control',key=None, resistor=None, edge_detection=None, debounce=None):
		self.pin = pin
		self.name = name
		self.key = key.replace(" ", "_").lower() if key is not None else self.name.replace(" ", "_").lower()
		self.gpio = GPIO
		self.debounce = debounce if debounce is not None else None

		if resistor is not None:
			if resistor == "up" or resistor == GPIO.PUD_UP:
				self.resistor = GPIO.PUD_UP
			elif resistor == "down" or resistor == GPIO.PUD_DOWN:
				self.resistor = GPIO.PUD_DOWN
		else:
			self.resistor = resistor

		if edge_detection is not None:
			if edge_detection == "falling" or edge_detection == GPIO.FALLING:
				self.edge_detection = GPIO.FALLING
			elif edge_detection == "rising" or edge_detection == GPIO.RISING:
				self.edge_detection = GPIO.RISING
			elif edge_detection == "both" or edge_detection == GPIO.BOTH:
				self.edge_detection = GPIO.BOTH
		else:
			self.edge_detection = None

		return 
Example #13
Source File: keypad.py    From rpieasy with GNU General Public License v3.0 5 votes vote down vote up
def initpins(self):
#   GPIO.setwarnings(False)
#   GPIO.setmode(GPIO.BCM)
   for po in self.colpins:
    GPIO.setup(po,GPIO.OUT)
   for pi in self.rowpins:
    GPIO.setup(pi,GPIO.IN,pull_up_down=GPIO.PUD_DOWN)
    try:
     GPIO.remove_event_detect(pi)
    except:
     pass
    time.sleep(0.05)
    GPIO.add_event_detect(pi,GPIO.RISING, callback=self.inthandler,bouncetime=200) 
Example #14
Source File: core.py    From zigate with MIT License 5 votes vote down vote up
def set_bootloader_mode(self):
        GPIO.output(27, GPIO.LOW)  # GPIO2
        GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)  # GPIO0
        sleep(0.5)
        GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_UP)  # GPIO0
        sleep(0.5) 
Example #15
Source File: core.py    From zigate with MIT License 5 votes vote down vote up
def set_running_mode(self):
        GPIO.output(27, GPIO.HIGH)  # GPIO2
        GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)  # GPIO0
        sleep(0.5)
        GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_UP)  # GPIO0
        sleep(0.5) 
Example #16
Source File: Simon.py    From 52-Weeks-of-Pi with MIT License 5 votes vote down vote up
def initialize_gpio():
    GPIO.setmode(GPIO.BOARD)
    GPIO.setup(LIGHTS, GPIO.OUT, initial=GPIO.LOW)
    GPIO.setup(BUTTONS, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
    for i in range(4):
        GPIO.add_event_detect(BUTTONS[i], GPIO.FALLING, verify_player_selection, 400 if use_sounds else 250) 
Example #17
Source File: flame.py    From raspberrypi-examples with MIT License 5 votes vote down vote up
def __init__(self, thread_id, notification_queue, sleeptime, pin = 27):
        super().__init__(thread_id, notification_queue, sleeptime) # python 3 syntax only
        self.pin = pin
        GPIO.setwarnings(False)
        GPIO.setmode(GPIO.BCM)
        GPIO.setup(pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) 
Example #18
Source File: steppertest.py    From rpi-film-capture with MIT License 5 votes vote down vote up
def __init__(self, triggerpin):
	GPIO.setup(triggerpin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
	self.pin = triggerpin 
Example #19
Source File: control.py    From rpi-film-capture with MIT License 5 votes vote down vote up
def __init__(self):
        GPIO.setmode(GPIO.BCM)
        self.light = lightControl(self.light_pin, True)
        self.redled = lightControl(self.red_pin)
        self.yellowled = lightControl(self.yellow_pin)
        self.motor = stepperControl()
        GPIO.setup(self.trigger_pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
        self.motorstate = 0
        self.smart_motor = False
        self.smart_headroom = 25
        self.triggertime = 0
        self.qlen = 5
        self.triggertimes = collections.deque([],self.qlen)
        self.phototimes = collections.deque([],self.qlen) 
Example #20
Source File: interface.py    From epd-library-python with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, vcom=-1.5):

        # check that we are root
        self.early_exit = False
        if geteuid() != 0:
            print("***EPD controller must be run as root!***")
            self.early_exit = True
            exit()

        self.spi = SPI()

        GPIO.setmode(GPIO.BCM)
        GPIO.setwarnings(False)
        GPIO.setup(Pins.HRDY, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
        GPIO.setup(Pins.RESET, GPIO.OUT, initial=GPIO.HIGH)

        # reset
        GPIO.output(Pins.RESET, GPIO.LOW)
        sleep(0.1)
        GPIO.output(Pins.RESET, GPIO.HIGH)

        self.width            = None
        self.height           = None
        self.img_buf_address  = None
        self.firmware_version = None
        self.lut_version      = None
        self.update_system_info()

        self._set_img_buf_base_addr(self.img_buf_address)

        # enable I80 packed mode
        self.write_register(Registers.I80CPCR, 0x1)

        self.set_vcom(vcom) 
Example #21
Source File: wlt_2_watchdog.py    From WLANThermo_v2 with GNU General Public License v3.0 5 votes vote down vote up
def halt_v3_pi():
    logger.info(_(u'Shutting down the Raspberry, Power Off (v3)'))
    # Stoppe die Dienste
    handle_service('WLANThermo', 'stop')
    handle_service('WLANThermoPIT', 'stop')
    # Schreibe aufs LCD
    tmp_filename = get_random_filename('/var/www/tmp/display/wd')
    while True:
        try:
            fw = open(tmp_filename, 'w')
            fw.write(_(u'---- ATTENTION!  ----;---- WLANThermo ----;is now shutting down;Bye-bye!'))
            fw.flush()
            os.fsync(fw.fileno())
            fw.close()
            os.rename(tmp_filename, '/var/www/tmp/display/wd')
        except IndexError:
            time.sleep(1)
            continue
        break
    # Sende Abschaltkommando an den ATtiny
    GPIO.setup(27, GPIO.OUT)
    GPIO.output(27,True)
    time.sleep(1)
    GPIO.output(27,False)
    time.sleep(1)
    GPIO.setup(27, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
    # Fahre Betriebssystem herunter
    bashCommand = 'sudo poweroff'
    retcode = subprocess.Popen(bashCommand.split())
    retcode.wait()
    if retcode < 0:
        logger.info(_(u'Terminated by signal'))
    else:
        logger.info(_(u'Child returned: ') + str(retcode)) 
Example #22
Source File: circo.py    From circo with MIT License 5 votes vote down vote up
def __init__(self, swmac, gwmac, ip, iface, wiface, dns, prx):
        threading.Thread.__init__(self)
        self.stoprequest = threading.Event()
        self.switchmac = swmac
        self.gwmac = gwmac
        self.ip = ip
        self.iface = iface
        self.wiface = wiface
        self.dns_srv = dns
        self.prxlist = prx
        GPIO.setmode(GPIO.BOARD)
        GPIO.setup(10, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) 
Example #23
Source File: deskcycle_test.py    From BlogCode with MIT License 5 votes vote down vote up
def __init__(self):

    
            print "setting up GPIO"

            GPIO.setmode(GPIO.BOARD)
            GPIO.setup(DeskCycle.PIN,GPIO.IN,pull_up_down=GPIO.PUD_UP)
            
            self.hitCount=0

            pin2=38
            GPIO.setup(pin2,GPIO.IN,pull_up_down=GPIO.PUD_DOWN)
            GPIO.add_event_detect(pin2, GPIO.FALLING, callback=self.pin_2_event,bouncetime=100) 
Example #24
Source File: CandleSimulation.py    From 52-Weeks-of-Pi with MIT License 5 votes vote down vote up
def initialize_gpio():
    GPIO.setmode(GPIO.BOARD)
    GPIO.setup([R,G], GPIO.OUT, initial=GPIO.LOW)
    GPIO.setup(BUTTON, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
    GPIO.add_event_detect(BUTTON, GPIO.FALLING, fan_the_flame, 250) 
Example #25
Source File: pi_power.py    From pi_power with MIT License 5 votes vote down vote up
def user_shutdown_setup(shutdown_pin):
    # setup the pin to check the shutdown switch - use the internal pull down resistor
    GPIO.setup(shutdown_pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

    # create a trigger for the shutdown switch
    GPIO.add_event_detect(shutdown_pin, GPIO.RISING, callback=user_shutdown, bouncetime=1000)

# User has pressed shutdown button - initiate a clean shutdown 
Example #26
Source File: NewEmailIndicator.py    From 52-Weeks-of-Pi with MIT License 5 votes vote down vote up
def initialize_gpio():
    GPIO.setmode(GPIO.BOARD)
    GPIO.setup(Gmail.PIN, GPIO.OUT)
    GPIO.setup(CHECK_NOW_PIN, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
    GPIO.add_event_detect(CHECK_NOW_PIN, GPIO.RISING, callback=check_mail_now, bouncetime=1000) 
Example #27
Source File: read.py    From rpiapi with MIT License 5 votes vote down vote up
def read(environ, response, parameter = None):
	
	status = "200 OK"
	
	header = [
		("Content-Type", "application/json"),
		("Cache-Control", "no-store, no-cache, must-revalidate"),
		("Expires", "0")
	]
	
	try:
	
		pin = int(parameter[0])
		
		mode = GPIO.PUD_UP
		
		if len(parameter) > 1 and parameter[1] == "down" :
		
			mode = GPIO.PUD_DOWN
	
		GPIO.setup(pin, GPIO.IN, pull_up_down=mode)
		
		result = GPIO.input(pin)
	
	except Exception as e:

		status = "400 Bad Request"

		result = str(e)

	response(status, header)

	return [json.dumps(result).encode()] 
Example #28
Source File: io_raspberry.py    From foos with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, bus, pin_number, team):
        self.bus = bus
        self.pin = pin_number
        self.team = team
        if self.pin:
            #GPIO.setup(self.pin, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
            GPIO.setup(self.pin, GPIO.IN, pull_up_down = GPIO.PUD_UP)
            GPIO.add_event_detect(self.pin, GPIO.FALLING, callback=self.on_goal, bouncetime=10)
        else:
            logger.warn("Cannot init GoalDetector {0}, pin not specified".format(self.team)) 
Example #29
Source File: __init__.py    From OctoPrint-PSUControl with GNU Affero General Public License v3.0 4 votes vote down vote up
def _configure_gpio(self):
        if not self._hasGPIO:
            self._logger.error("RPi.GPIO is required.")
            return
        
        self._logger.info("Running RPi.GPIO version %s" % GPIO.VERSION)
        if GPIO.VERSION < "0.6":
            self._logger.error("RPi.GPIO version 0.6.0 or greater required.")
        
        GPIO.setwarnings(False)

        for pin in self._configuredGPIOPins:
            self._logger.debug("Cleaning up pin %s" % pin)
            try:
                GPIO.cleanup(self._gpio_get_pin(pin))
            except (RuntimeError, ValueError) as e:
                self._logger.error(e)
        self._configuredGPIOPins = []

        if GPIO.getmode() is None:
            if self.GPIOMode == 'BOARD':
                GPIO.setmode(GPIO.BOARD)
            elif self.GPIOMode == 'BCM':
                GPIO.setmode(GPIO.BCM)
            else:
                return
        
        if self.sensingMethod == 'GPIO':
            self._logger.info("Using GPIO sensing to determine PSU on/off state.")
            self._logger.info("Configuring GPIO for pin %s" % self.senseGPIOPin)

            if self.senseGPIOPinPUD == 'PULL_UP':
                pudsenseGPIOPin = GPIO.PUD_UP
            elif self.senseGPIOPinPUD == 'PULL_DOWN':
                pudsenseGPIOPin = GPIO.PUD_DOWN
            else:
                pudsenseGPIOPin = GPIO.PUD_OFF
    
            try:
                GPIO.setup(self._gpio_get_pin(self.senseGPIOPin), GPIO.IN, pull_up_down=pudsenseGPIOPin)
                self._configuredGPIOPins.append(self.senseGPIOPin)
            except (RuntimeError, ValueError) as e:
                self._logger.error(e)
        
        if self.switchingMethod == 'GPIO':
            self._logger.info("Using GPIO for On/Off")
            self._logger.info("Configuring GPIO for pin %s" % self.onoffGPIOPin)
            try:
                if not self.invertonoffGPIOPin:
                    initial_pin_output=GPIO.LOW
                else:
                    initial_pin_output=GPIO.HIGH
                GPIO.setup(self._gpio_get_pin(self.onoffGPIOPin), GPIO.OUT, initial=initial_pin_output)
                self._configuredGPIOPins.append(self.onoffGPIOPin)
            except (RuntimeError, ValueError) as e:
                self._logger.error(e) 
Example #30
Source File: lib_rpigpios.py    From rpieasy with GNU General Public License v3.0 4 votes vote down vote up
def setpinstate(self,PINID,state,force=False):
   if (force==False):
    if Settings.Pinout[PINID]["altfunc"]>0 or Settings.Pinout[PINID]["canchange"]!=1 or Settings.Pinout[PINID]["BCM"]<0:
     return False
#   if (int(state)<=0 and int(Settings.Pinout[PINID]["startupstate"])>0):
   if int(state)<=0:
#    pass # revert to default input
    Settings.Pinout[PINID]["startupstate"] = -1
    if self.gpioinit:
     GPIO.setup(int(Settings.Pinout[PINID]["BCM"]), GPIO.IN)
    self.setpinactualstate(PINID,99) # ugly hack
    return True
   elif state==1:
    pass # input
    Settings.Pinout[PINID]["startupstate"] = state
    if self.gpioinit:
     GPIO.setup(int(Settings.Pinout[PINID]["BCM"]), GPIO.IN)
    self.setpinactualstate(PINID,1)
    return True
   elif state==2:
    pass # input pulldown
    Settings.Pinout[PINID]["startupstate"] = state
    if self.gpioinit:
     GPIO.setup(int(Settings.Pinout[PINID]["BCM"]), GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
    self.setpinactualstate(PINID,state)
    return True
   elif state==3:
    pass # input pullup
    Settings.Pinout[PINID]["startupstate"] = state
    if self.gpioinit:
     GPIO.setup(int(Settings.Pinout[PINID]["BCM"]), GPIO.IN, pull_up_down=GPIO.PUD_UP)
    self.setpinactualstate(PINID,state)
    return True
   elif state==4 or state==5 or state==6:
    if state==5:
     if self.gpioinit:
      GPIO.setup(int(Settings.Pinout[PINID]["BCM"]), GPIO.OUT, initial=GPIO.LOW)
    elif state==6:
     if self.gpioinit:
      GPIO.setup(int(Settings.Pinout[PINID]["BCM"]), GPIO.OUT, initial=GPIO.HIGH)
    else:
     if self.gpioinit:
      GPIO.setup(int(Settings.Pinout[PINID]["BCM"]), GPIO.OUT)
    Settings.Pinout[PINID]["startupstate"] = state
    self.setpinactualstate(PINID,4)
    return True
   elif state==7:
    self.enable_pwm_pin(0,int(Settings.Pinout[PINID]["BCM"]))
    if Settings.Pinout[PINID]["startupstate"] != 7:
     self.enable_pwm_pin(1,int(Settings.Pinout[PINID]["BCM"]))
    return True
   elif state==8:
    self.setpinactualstate(PINID,-1)
    self.set1wgpio(int(Settings.Pinout[PINID]["BCM"]))
    return True
   elif state in [10,11,12]:
    self.setpinactualstate(PINID,-1)
    self.setirgpio(int(Settings.Pinout[PINID]["BCM"]),mode=(state-10))
    return True
   return False