Python machine.Pin.OUT Examples

The following are 30 code examples of machine.Pin.OUT(). 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 machine.Pin , or try the search function .
Example #1
Source File: output.py    From ulnoiot-upy with MIT License 6 votes vote down vote up
def __init__(self, name, pin, *args, high_command='on', low_command='off',
                 ignore_case=True, on_change=None, report_change=False):
        if len(args) > 0:
            high_command = args[0]
            if len(args) > 1:
                low_command = args[1]
        if ignore_case:
            high_command = high_command.lower()
            low_command = low_command.lower()
        self.high_command = high_command
        self.low_command = low_command
        Device.__init__(self, name, pin,
                        setters={"set": self.evaluate}, ignore_case=ignore_case,
                        on_change=on_change, report_change=report_change,
                        value_map={1: self.high_command, 0: self.low_command})
        pin.init(Pin.OUT)
        self.state = pin() 
Example #2
Source File: main.py    From microhomie with MIT License 6 votes vote down vote up
def __init__(self, name="Onboard LED", pin=2):
        super().__init__(id="led", name=name, type="LED")
        self.pin = pin
        self.led = Pin(pin, Pin.OUT, value=0)
        self.btn = Pushbutton(Pin(0, Pin.IN, Pin.PULL_UP))
        self.btn.press_func(self.toggle_led)

        self.power_property = HomieNodeProperty(
            id="power",
            name="LED Power",
            settable=True,
            datatype=BOOLEAN,
            default=TRUE,
        )

        self.add_property(self.power_property, self.on_power_msg) 
Example #3
Source File: buzzer.py    From developer-badge-2018-apps with Apache License 2.0 6 votes vote down vote up
def __init__(self):
        self.notes = {
            'cdef': [
                self.C6, self.D6, self.E6, self.F6, self.G6, self.A6, self.B6, self.C7, self.D7, self.E7, self.F7, self.G7, self.A7, self.B7, self.C8, 0
            ],
            'mario': [
                self.E7, self.E7,  0, self.E7,  0, self.C7, self.E7,  0, self.G7,  0,  0,  0, self.G6,  0,  0,  0,
                self.C7,  0,  0, self.G6,  0,  0, self.E6,  0,  0, self.A6,  0, self.B6,  0, self.AS6, self.A6, 0,
                self.G6, self.E7,  0, self.G7, self.A7,  0, self.F7, self.G7,  0, self.E7,  0, self.C7, self.D7, self.B6,  0,  0,
                self.C7,  0,  0, self.G6,  0,  0, self.E6,  0,  0, self.A6,  0, self.B6,  0, self.AS6, self.A6, 0,
                self.G6, self.E7,  0, self.G7, self.A7,  0, self.F7, self.G7,  0, self.E7,  0, self.C7, self.D7, self.B6,  0,  0
            ],
            'starwars': [
                self.A4,  0,  0,  0, self.A4,  0,  0,  0, self.A4,  0,  0,  0, self.F4,  0,  0, self.C5,
                self.A4,  0,  0,  0, self.F4,  0,  0, self.C5, self.A4,  0,  0,  0,  0,  0,  0,  0,
                self.E5,  0,  0,  0, self.E5,  0,  0,  0, self.E5,  0,  0,  0, self.F5,  0,  0, self.C5,
                self.GS4, 0,  0,  0, self.F4,  0,  0, self.C5, self.A4,  0,  0,  0,  0,  0,  0,  0,
            ],
        }

        # Init
        self.pwm = PWM(Pin(27, Pin.OUT))
        self.pwm.duty(0) 
Example #4
Source File: buzzer.py    From developer-badge-2018-apps with Apache License 2.0 6 votes vote down vote up
def __init__(self):
        self.notes = {
            'cdef': [
                self.C6, self.D6, self.E6, self.F6, self.G6, self.A6, self.B6, self.C7, self.D7, self.E7, self.F7, self.G7, self.A7, self.B7, self.C8, 0
            ],
            'mario': [
                self.E7, self.E7,  0, self.E7,  0, self.C7, self.E7,  0, self.G7,  0,  0,  0, self.G6,  0,  0,  0,
                self.C7,  0,  0, self.G6,  0,  0, self.E6,  0,  0, self.A6,  0, self.B6,  0, self.AS6, self.A6, 0,
                self.G6, self.E7,  0, self.G7, self.A7,  0, self.F7, self.G7,  0, self.E7,  0, self.C7, self.D7, self.B6,  0,  0,
                self.C7,  0,  0, self.G6,  0,  0, self.E6,  0,  0, self.A6,  0, self.B6,  0, self.AS6, self.A6, 0,
                self.G6, self.E7,  0, self.G7, self.A7,  0, self.F7, self.G7,  0, self.E7,  0, self.C7, self.D7, self.B6,  0,  0
            ],
            'starwars': [
                self.A4,  0,  0,  0, self.A4,  0,  0,  0, self.A4,  0,  0,  0, self.F4,  0,  0, self.C5,
                self.A4,  0,  0,  0, self.F4,  0,  0, self.C5, self.A4,  0,  0,  0,  0,  0,  0,  0,
                self.E5,  0,  0,  0, self.E5,  0,  0,  0, self.E5,  0,  0,  0, self.F5,  0,  0, self.C5,
                self.GS4, 0,  0,  0, self.F4,  0,  0, self.C5, self.A4,  0,  0,  0,  0,  0,  0,  0,
            ],
        }

        # Init
        self.pwm = PWM(Pin(27, Pin.OUT))
        self.pwm.duty(0) 
Example #5
Source File: buzzer.py    From developer-badge-2018-apps with Apache License 2.0 6 votes vote down vote up
def playnotes(self, title, length=150, duty=64):
        # Init
        p = Pin(27, Pin.OUT)
        self.pwm = PWM(p)
        self.pwm.duty(0)

        if title not in self.notes:
          print('unknown title: {}'.format(title))
          return

        melody = self.notes[title]
        print('Play', title)
        for i in melody:
            if i == 0:
                self.pwm.duty(0)
            else:
                self.pwm.freq(i)
                self.pwm.duty(duty)
            time.sleep_ms(length)

        # deinit
        self.pwm.deinit() 
Example #6
Source File: main.py    From microhomie with MIT License 6 votes vote down vote up
def __init__(self, id, rpin, swpin, name="Light Switch", type="Shelly"):
        super().__init__(id=id, name=name, type=type)
        self.relay = Pin(rpin, Pin.OUT, value=0)
        self.switch = Switch(Pin(swpin, Pin.IN))

        self.power_property = HomieNodeProperty(
            id=id,
            name="Power",
            settable=True,
            datatype=BOOLEAN,
            default=FALSE,
        )
        self.add_property(self.power_property, self.on_power_msg)

        self.switch.open_func(self.toggle, ())
        self.switch.close_func(self.toggle, ()) 
Example #7
Source File: hcsr04.py    From uPySensors with Apache License 2.0 6 votes vote down vote up
def __init__(self, trigger_pin, echo_pin, echo_timeout_us=500*2*30):
        """
        trigger_pin: Output pin to send pulses
        echo_pin: Readonly pin to measure the distance. The pin should be protected with 1k resistor
        echo_timeout_us: Timeout in microseconds to listen to echo pin.
        By default is based in sensor limit range (4m)
        """
        self.echo_timeout_us = echo_timeout_us
        # Init trigger pin (out)
        self.trigger = Pin(trigger_pin, mode=Pin.OUT)
        self.trigger.value(0)
        # Init echo pin (in)
        if (uname().sysname == 'WiPy'):
            self.echo = Pin(echo_pin, mode=Pin.OPEN_DRAIN)
        else:
            self.echo = Pin(echo_pin, mode=Pin.IN) 
Example #8
Source File: main.py    From microhomie with MIT License 6 votes vote down vote up
def __init__(self):
        super().__init__(
            id="relay", name="Wifi Power Socket", type="OW8266-02Q"
        )
        self.led = Pin(4, Pin.OUT, value=1)
        self.r_on = Pin(12, Pin.OUT)
        self.r_off = Pin(5, Pin.OUT)

        self.power_property = HomieNodeProperty(
            id="power",
            name="Relay",
            settable=True,
            retained=True,
            datatype=BOOLEAN,
            default=FALSE,
            restore=True,
        )
        self.add_property(self.power_property, self.on_power_msg)

        self.button = Pushbutton(Pin(14, Pin.IN, Pin.PULL_UP))
        self.button.release_func(self.toggle, ())
        self.button.long_func(reset, (self.led,)) 
Example #9
Source File: controller_esp.py    From SX127x_driver_for_MicroPython_on_ESP8266 with GNU General Public License v3.0 6 votes vote down vote up
def get_spi(self): 
        spi = None
        id = 1
        
        if config_lora.IS_ESP8266:
            spi = SPI(id, baudrate = 10000000, polarity = 0, phase = 0)
            spi.init()
            
        if config_lora.IS_ESP32:
            try:
                if config_lora.SOFT_SPI: id = -1              
                spi = SPI(id, baudrate = 10000000, polarity = 0, phase = 0, bits = 8, firstbit = SPI.MSB,
                          sck = Pin(self.PIN_ID_SCK, Pin.OUT, Pin.PULL_DOWN),
                          mosi = Pin(self.PIN_ID_MOSI, Pin.OUT, Pin.PULL_UP),
                          miso = Pin(self.PIN_ID_MISO, Pin.IN, Pin.PULL_UP))
                spi.init()
                    
            except Exception as e:
                print(e)
                if spi: 
                    spi.deinit()
                    spi = None
                reset()  # in case SPI is already in use, need to reset. 
        
        return spi 
Example #10
Source File: esp_8266Full.py    From python_banyan with GNU Affero General Public License v3.0 6 votes vote down vote up
def digital_write(self, payload):
        """
        Write to a digital gpio pin
        :param payload:
        :return:
        """
        pin = payload['pin']
        mode = Pin.OUT
        if 'drain' in payload:
            if not payload['drain']:
                mode = Pin.OPEN_DRAIN
        pin_object = Pin(pin, mode)
        pwm = PWM(pin_object)
        pwm.deinit()
        Pin(pin, mode, value=payload['value'])
        self.input_pin_objects[pin] = None 
Example #11
Source File: sr_passive.py    From micropython-async with MIT License 6 votes vote down vote up
def test():
    freq(160000000)
    dout = Pin(14, Pin.OUT, value = 0)     # Define pins
    ckout = Pin(15, Pin.OUT, value = 0)    # clocks must be initialised to zero.
    din = Pin(13, Pin.IN)
    ckin = Pin(12, Pin.IN)

    channel = SynCom(True, ckin, ckout, din, dout)
    loop = asyncio.get_event_loop()
    loop.create_task(heartbeat())
    loop.create_task(channel.start(passive_task))
    try:
        loop.run_forever()
    except KeyboardInterrupt:
        pass
    finally:
        ckout(0) 
Example #12
Source File: mfrc522.py    From micropython-mfrc522 with MIT License 6 votes vote down vote up
def __init__(self, sck, mosi, miso, rst, cs):

		self.sck = Pin(sck, Pin.OUT)
		self.mosi = Pin(mosi, Pin.OUT)
		self.miso = Pin(miso)
		self.rst = Pin(rst, Pin.OUT)
		self.cs = Pin(cs, Pin.OUT)

		self.rst.value(0)
		self.cs.value(1)
		
		board = uname()[0]

		if board == 'WiPy' or board == 'LoPy' or board == 'FiPy':
			self.spi = SPI(0)
			self.spi.init(SPI.MASTER, baudrate=1000000, pins=(self.sck, self.mosi, self.miso))
		elif board == 'esp8266':
			self.spi = SPI(baudrate=100000, polarity=0, phase=0, sck=self.sck, mosi=self.mosi, miso=self.miso)
			self.spi.init()
		else:
			raise RuntimeError("Unsupported platform")

		self.rst.value(1)
		self.init() 
Example #13
Source File: heartbeat.py    From micropython-async with MIT License 6 votes vote down vote up
def heartbeat(tms):
    if platform == 'pyboard':  # V1.x or D series
        from pyb import LED
        led = LED(1)
    elif platform == 'esp8266':
        from machine import Pin
        led = Pin(2, Pin.OUT, value=1)
    elif platform == 'linux':
        return  # No LED
    else:
        raise OSError('Unsupported platform.')
    while True:
        if platform == 'pyboard':
            led.toggle()
        elif platform == 'esp8266':
            led(not led())
        await asyncio.sleep_ms(tms) 
Example #14
Source File: art1.py    From micropython-async with MIT License 6 votes vote down vote up
def test():
    print('Test for IR receiver. Assumes NEC protocol. Turn LED on or off.')
    if platform == 'pyboard':
        p = Pin('X3', Pin.IN)
        led = LED(2)
    elif platform == 'esp8266':
        freq(160000000)
        p = Pin(13, Pin.IN)
        led = Pin(2, Pin.OUT)
        led(1)
    elif ESP32:
        p = Pin(23, Pin.IN)
        led = Pin(21, Pin.OUT)  # LED with 220Ω series resistor between 3.3V and pin 21
        led(1)
    ir = NEC_IR(p, cb, True, led)  # Assume extended address mode r/c
    loop = asyncio.get_event_loop()
    loop.run_forever() 
Example #15
Source File: main.py    From microhomie with MIT License 6 votes vote down vote up
def __init__(self, name="Relay 16A"):
        super().__init__(id="relay", name=name, type="Gosund SP1")

        # disable REPL so we can use the blue led
        uos.dupterm(None, 1)

        self.led_b = Pin(1, Pin.OUT, value=1)  # Blue LED
        self.led_r = Pin(13, Pin.OUT, value=1)  # Red LED
        self.relay = Pin(14, Pin.OUT)

        self.power_property = HomieNodeProperty(
            id="power",
            name="Power",
            settable=True,
            datatype=BOOLEAN,
            default=FALSE,
        )
        self.add_property(self.power_property, self.on_power_msg)

        self.button = Pushbutton(Pin(3, Pin.IN))
        self.button.release_func(self.toggle, ())
        self.button.long_func(reset, (self.led_r,)) 
Example #16
Source File: output.py    From ulnoiot-upy with MIT License 6 votes vote down vote up
def __init__(self, name, pin, *args, high_command='on', low_command='off',
                 ignore_case=True, on_change=None, report_change=False):
        if len(args) > 0:
            high_command = args[0]
            if len(args) > 1:
                low_command = args[1]
        if ignore_case:
            high_command = high_command.lower()
            low_command = low_command.lower()
        self.high_command = high_command
        self.low_command = low_command
        Device.__init__(self, name, pin,
                        setters={"set": self.evaluate}, ignore_case=ignore_case,
                        on_change=on_change, report_change=report_change,
                        value_map={1: self.high_command, 0: self.low_command})
        pin.init(Pin.OUT)
        self.state = pin() 
Example #17
Source File: output.py    From ulnoiot-upy with MIT License 6 votes vote down vote up
def __init__(self, name, pin, *args, high_command='on', low_command='off',
                 ignore_case=True, on_change=None, report_change=False):
        if len(args) > 0:
            high_command = args[0]
            if len(args) > 1:
                low_command = args[1]
        if ignore_case:
            high_command = high_command.lower()
            low_command = low_command.lower()
        self.high_command = high_command
        self.low_command = low_command
        Device.__init__(self, name, pin,
                        setters={"set": self.evaluate}, ignore_case=ignore_case,
                        on_change=on_change, report_change=report_change,
                        value_map={1: self.high_command, 0: self.low_command})
        pin.init(Pin.OUT)
        self.state = pin() 
Example #18
Source File: output.py    From ulnoiot-upy with MIT License 6 votes vote down vote up
def __init__(self, name, pin, *args, high_command='on', low_command='off',
                 ignore_case=True, on_change=None, report_change=False):
        if len(args) > 0:
            high_command = args[0]
            if len(args) > 1:
                low_command = args[1]
        if ignore_case:
            high_command = high_command.lower()
            low_command = low_command.lower()
        self.high_command = high_command
        self.low_command = low_command
        Device.__init__(self, name, pin,
                        setters={"set": self.evaluate}, ignore_case=ignore_case,
                        on_change=on_change, report_change=report_change,
                        value_map={1: self.high_command, 0: self.low_command})
        pin.init(Pin.OUT)
        self.state = pin() 
Example #19
Source File: epd1in54b.py    From micropython-waveshare-epd with MIT License 6 votes vote down vote up
def __init__(self, reset, dc, busy, cs, clk, mosi):
        self.reset_pin = reset
        self.reset_pin.mode(Pin.OUT)

        self.dc_pin = dc
        self.dc_pin.mode(Pin.OUT)

        self.busy_pin = busy
        self.busy_pin.mode(Pin.IN)

        self.cs_pin = cs
        self.cs_pin.mode(Pin.OUT)
        self.cs_pin.pull(Pin.PULL_UP)

        self.spi = SPI(0, mode=SPI.MASTER, baudrate=2000000, polarity=0, phase=0, pins=(clk, mosi, None))

        self.width = EPD_WIDTH
        self.height = EPD_HEIGHT
        self.rotate = ROTATE_0 
Example #20
Source File: tinypico.py    From tinypico-micropython with MIT License 6 votes vote down vote up
def set_dotstar_power(state):
    """Set the power for the on-board Dostar to allow no current draw when not needed."""
    # Set the power pin to the inverse of state
    if state:
        Pin(DOTSTAR_PWR, Pin.OUT, None)  # Break the PULL_HOLD on the pin
        Pin(DOTSTAR_PWR).value(False)  # Set the pin to LOW to enable the Transistor
    else:
        Pin(13, Pin.IN, Pin.PULL_HOLD)  # Set PULL_HOLD on the pin to allow the 3V3 pull-up to work

    Pin(
        DOTSTAR_CLK, Pin.OUT if state else Pin.IN
    )  # If power is on, set CLK to be output, otherwise input
    Pin(
        DOTSTAR_DATA, Pin.OUT if state else Pin.IN
    )  # If power is on, set DATA to be output, otherwise input

    # A small delay to let the IO change state
    time.sleep(0.035)


# Dotstar rainbow colour wheel 
Example #21
Source File: tinypico.py    From tinypico-micropython with MIT License 6 votes vote down vote up
def set_dotstar_power(state):
    """Set the power for the on-board Dostar to allow no current draw when not needed."""
    # Set the power pin to the inverse of state
    if state:
        Pin(DOTSTAR_PWR, Pin.OUT, None)  # Break the PULL_HOLD on the pin
        Pin(DOTSTAR_PWR).value(False)  # Set the pin to LOW to enable the Transistor
    else:
        Pin(13, Pin.IN, Pin.PULL_HOLD)  # Set PULL_HOLD on the pin to allow the 3V3 pull-up to work

    Pin(
        DOTSTAR_CLK, Pin.OUT if state else Pin.IN
    )  # If power is on, set CLK to be output, otherwise input
    Pin(
        DOTSTAR_DATA, Pin.OUT if state else Pin.IN
    )  # If power is on, set DATA to be output, otherwise input

    # A small delay to let the IO change state
    time.sleep(0.035)


# Dotstar rainbow colour wheel 
Example #22
Source File: tinypico.py    From tinypico-micropython with MIT License 6 votes vote down vote up
def set_dotstar_power(state):
    """Set the power for the on-board Dostar to allow no current draw when not needed."""
    # Set the power pin to the inverse of state
    if state:
        Pin(DOTSTAR_PWR, Pin.OUT, None)  # Break the PULL_HOLD on the pin
        Pin(DOTSTAR_PWR).value(False)  # Set the pin to LOW to enable the Transistor
    else:
        Pin(13, Pin.IN, Pin.PULL_HOLD)  # Set PULL_HOLD on the pin to allow the 3V3 pull-up to work

    Pin(
        DOTSTAR_CLK, Pin.OUT if state else Pin.IN
    )  # If power is on, set CLK to be output, otherwise input
    Pin(
        DOTSTAR_DATA, Pin.OUT if state else Pin.IN
    )  # If power is on, set DATA to be output, otherwise input

    # A small delay to let the IO change state
    time.sleep(0.035)


# Dotstar rainbow colour wheel 
Example #23
Source File: motor.py    From 1ZLAB_PyEspCar with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, idx, is_debug=False):
        
        gpio_a, gpio_b, self.motor_install_dir = Motor.MOTOR_LIST[idx]
        # A相PWM
        self.pwm_a = PWM(
            Pin(gpio_a, Pin.OUT),
            freq = Motor.MOTOR_PWM_FREQUENCY,
            duty = 0)
        
        # B相PWM
        self.pwm_b = PWM(
            Pin(gpio_b, Pin.OUT),
            freq = Motor.MOTOR_PWM_FREQUENCY,
            duty = 0)
        
        # 电机安装方向
        if not self.motor_install_dir:
            self.pwm_a, self.pwm_b = self.pwm_b, self.pwm_a
        
        # 电机速度信号 取值范围: -1023 - 1023 
        self._pwm = 0
        # 设置电机的PWM
        # self.pwm(self._pwm) 
Example #24
Source File: sht1x.py    From upython-aq-monitor with MIT License 6 votes vote down vote up
def __init__(self, gnd, sck, data, vcc):
        self.gnd = gnd
        self.sck = sck
        self.data = data
        self.vcc = vcc

        self.gnd.mode(Pin.OUT)
        self.vcc.mode(Pin.OUT)
        self.sck.mode(Pin.OUT)
        self.data.mode(Pin.OPEN_DRAIN)

        self.gnd.pull(Pin.PULL_DOWN)
        self.vcc.pull(Pin.PULL_UP)
        self.sck.pull(Pin.PULL_DOWN)
        self.data.pull(None)

        self.sleep() 
Example #25
Source File: art1.py    From micropython-async with MIT License 6 votes vote down vote up
def test():
    print('Test for IR receiver. Assumes NEC protocol. Turn LED on or off.')
    if platform == 'pyboard':
        p = Pin('X3', Pin.IN)
        led = LED(2)
    elif platform == 'esp8266':
        freq(160000000)
        p = Pin(13, Pin.IN)
        led = Pin(2, Pin.OUT)
        led(1)
    elif ESP32:
        p = Pin(23, Pin.IN)
        led = Pin(21, Pin.OUT)  # LED with 220Ω series resistor between 3.3V and pin 21
        led(1)
    ir = NEC_IR(p, cb, True, led)  # Assume extended address mode r/c
    loop = asyncio.get_event_loop()
    try:
        loop.run_forever()
    except KeyboardInterrupt:
        print('Interrupted')
    finally:
        asyncio.new_event_loop()  # Still need ctrl-d because of interrupt vector 
Example #26
Source File: digitalio.py    From Adafruit_Blinka with MIT License 5 votes vote down vote up
def direction(self, value):
        self.__direction = value
        if value is Direction.OUTPUT:
            self._pin.init(mode=Pin.OUT)
            self.value = False
            self.drive_mode = DriveMode.PUSH_PULL
        elif value is Direction.INPUT:
            self._pin.init(mode=Pin.IN)
            self.pull = None
        else:
            raise AttributeError("Not a Direction") 
Example #27
Source File: led.py    From 1ZLAB_MicroPython_ESP32_Tutorial with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, led_id):
        # LED字典 
        # 数据结构: (gpio管脚编号, LED灭的电平, LED亮的电平)
        led_list = [(2, False, True),(13, True, False)]

        if led_id >= len(led_list) or led_id < 0:
            print('ERROR:LED编号无效, 有效ID:{} - {}'.format(0, len(led_list-1)))
            return None
        
        gpio_id, self.LED_OFF, self.LED_ON = led_list[led_id]
        self.pin = Pin(gpio_id, Pin.OUT)
        self.pwm = PWM(self.pin, freq=1000) 
Example #28
Source File: hx711.py    From micropython-hx711 with MIT License 5 votes vote down vote up
def __init__(self, d_out: int, pd_sck: int, channel: int = CHANNEL_A_128):
        self.d_out_pin = Pin(d_out, Pin.IN)
        self.pd_sck_pin = Pin(pd_sck, Pin.OUT, value=0)
        self.channel = channel 
Example #29
Source File: TM1637.py    From mpy-lib with MIT License 5 votes vote down vote up
def __init__(self, clk, dio, intensity=7, number = 4):
        self.clk = clk
        self.dio = dio

        self._intensity = intensity%8
        self._LED = number
        self._ON = 8
        self.dbuf = [0, 0, 0, 0]

        self.clk.init(Pin.OUT, value=0)
        self.dio.init(Pin.OUT, value=0)
        sleep_us(TM1637_DELAY)

        self.clear() 
Example #30
Source File: mpu6050.py    From py-mpu6050 with GNU General Public License v3.0 5 votes vote down vote up
def init_pins(self):
        print('* initializing pins')
        self.pin_sda = Pin(self.sda)
        self.pin_scl = Pin(self.scl)
        self.pin_intr = Pin(self.intr, mode=Pin.IN)
        self.pin_led = PWM(Pin(self.led, mode=Pin.OUT))