platypush/plugins/esp/__init__.py
def pwm_duty(self, pin: Union[int, str], duty: Optional[int] = None, **kwargs) -> Optional[int]:
        """
        Get/set the duty cycle of a PWM PIN.

        :param pin: GPIO PIN number or configured name.
        :param duty: Optional duty value to set.
        :param kwargs: Parameters to pass to :meth:`platypush.plugins.esp.EspPlugin.execute`.
        """
        device = self._get_device(**kwargs)
        pin = device.get_pin(pin)
        code = '''
import machine
pin = machine.PWM(machine.Pin({pin}))
pin.duty({duty})
'''.format(pin=pin, duty=duty if duty else '')

        ret = self.execute(code, **kwargs).output
        if not duty:
            return int(ret)

        Get/set the duty cycle of a PWM PIN.

        :param pin: GPIO PIN number or configured name.
        :param duty: Optional duty value to set.
        :param kwargs: Parameters to pass to :meth:`platypush.plugins.esp.EspPlugin.execute`.
        
Get/set the duty cycle of a PWM PIN.
Get / set the duty cycle of a PWM PIN .
def pwm_duty(self, pin: Union[int, str], duty: Optional[int] = None, **kwargs) -> Optional[int]:
        device = self._get_device(**kwargs)
        pin = device.get_pin(pin)
        code = '''
import machine
pin = machine.PWM(machine.Pin({pin}))
pin.duty({duty})
'''.format(pin=pin, duty=duty if duty else '')
        ret = self.execute(code, **kwargs).output
        if not duty:
            return int(ret)
def pwm_duty ( self , pin : Union [ int , str ] , duty : Optional [ int ] = None , ** kwargs ) -> Optional [ int ] : device = self . _get_device ( ** kwargs ) pin = device . get_pin ( pin ) code = '''
import machine
pin = machine.PWM(machine.Pin({pin}))
pin.duty({duty})
''' . format ( pin = pin , duty = duty if duty else '' ) ret = self . execute ( code , ** kwargs ) . output if not duty : return int ( ret )
Get/set the duty cycle of a PWM PIN.
Get / set the duty cycle of a PWM PIN .
"""
        Get/set the duty cycle of a PWM PIN.

        :param pin: GPIO PIN number or configured name.
        :param duty: Optional duty value to set.
        :param kwargs: Parameters to pass to :meth:`platypush.plugins.esp.EspPlugin.execute`.
        """
self
pin
Union[int, str]
GPIO PIN number or configured name.
GPIO PIN number or configured name .
duty
Optional[int]
Optional duty value to set.
Optional duty value to set .
kwargs
Parameters to pass to :meth:`platypush.plugins.esp.EspPlugin.execute`.
Parameters to pass to : meth : ` platypush . plugins . esp . EspPlugin . execute ` .