I2C TypeError:extra positional arguments given
Posted: Thu Oct 29, 2020 11:56 am
This code works ...
>>>From machine import I2C, Pin
>>>i2c = I2C(scl=Pin(22), sda=Pin(21))
This code has error ...
>>>From machine import I2C, Pin
>>>scl = Pin(22)
>>>sda = Pin(21)
>>>i2c = I2C(scl, sda)
Traceback (most recent call last):
File "<stdin", line 1, in <module>
TypeError: extra positional arguments given
Why doesn't this work!! What is differnt about the two blocks of code?
Any help much apreciated
Frank
>>>From machine import I2C, Pin
>>>i2c = I2C(scl=Pin(22), sda=Pin(21))
This code has error ...
>>>From machine import I2C, Pin
>>>scl = Pin(22)
>>>sda = Pin(21)
>>>i2c = I2C(scl, sda)
Traceback (most recent call last):
File "<stdin", line 1, in <module>
TypeError: extra positional arguments given
Why doesn't this work!! What is differnt about the two blocks of code?
Any help much apreciated
Frank