platypush/plugins/gpio/__init__.py
def write(self, pin: Union[int, str], value: Union[int, bool],
              name: Optional[str] = None) -> Dict[str, Any]:
        """
        Write a byte value to a pin.

        :param pin: PIN number or configured name
        :param name: Optional name for the written value (e.g. "temperature" or "humidity")
        :param value: Value to write

        Response::

            output = {
                "name": <pin or metric name>,
                "pin": <pin>,
                "value": <value>,
                "method": "write"
            }
        """

        import RPi.GPIO as GPIO

        self._init_board()
        name = name or pin
        pin = self._get_pin_number(pin)

        if pin not in self._initialized_pins or self._initialized_pins[pin] != GPIO.OUT:
            GPIO.setup(pin, GPIO.OUT)
            self._initialized_pins[pin] = GPIO.OUT

        GPIO.setup(pin, GPIO.OUT)
        GPIO.output(pin, value)

        return {
            'name': name,
            'pin': pin,
            'value': value,
            'method': 'write',
        }

        Write a byte value to a pin.

        :param pin: PIN number or configured name
        :param name: Optional name for the written value (e.g. "temperature" or "humidity")
        :param value: Value to write

        Response::

            output = {
                "name": <pin or metric name>,
                "pin": <pin>,
                "value": <value>,
                "method": "write"
            }
        
Write a byte value to a pin.
Write a byte value to a pin .
def write(self, pin: Union[int, str], value: Union[int, bool],
              name: Optional[str] = None) -> Dict[str, Any]:
        import RPi.GPIO as GPIO
        self._init_board()
        name = name or pin
        pin = self._get_pin_number(pin)
        if pin not in self._initialized_pins or self._initialized_pins[pin] != GPIO.OUT:
            GPIO.setup(pin, GPIO.OUT)
            self._initialized_pins[pin] = GPIO.OUT
        GPIO.setup(pin, GPIO.OUT)
        GPIO.output(pin, value)
        return {
            'name': name,
            'pin': pin,
            'value': value,
            'method': 'write',
        }
def write ( self , pin : Union [ int , str ] , value : Union [ int , bool ] , name : Optional [ str ] = None ) -> Dict [ str , Any ] : import RPi . GPIO as GPIO self . _init_board ( ) name = name or pin pin = self . _get_pin_number ( pin ) if pin not in self . _initialized_pins or self . _initialized_pins [ pin ] != GPIO . OUT : GPIO . setup ( pin , GPIO . OUT ) self . _initialized_pins [ pin ] = GPIO . OUT GPIO . setup ( pin , GPIO . OUT ) GPIO . output ( pin , value ) return { 'name' : name , 'pin' : pin , 'value' : value , 'method' : 'write' , }
Write a byte value to a pin.
Write a byte value to a pin .
"""
        Write a byte value to a pin.

        :param pin: PIN number or configured name
        :param name: Optional name for the written value (e.g. "temperature" or "humidity")
        :param value: Value to write

        Response::

            output = {
                "name": <pin or metric name>,
                "pin": <pin>,
                "value": <value>,
                "method": "write"
            }
        """
self
pin
Union[int, str]
PIN number or configured name
PIN number or configured name
value
Union[int, bool]
Value to write
Response:.


Value to write Response : .
name
Optional[str]
Optional name for the written value
Optional name for the written value