Skip to content

Commit 9ff36db

Browse files
committed
ads1x15.py: define Pin if import fails
1 parent ec00ae4 commit 9ff36db

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

adafruit_ads1x15/ads1x15.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
from busio import I2C
2626
from microcontroller import Pin
2727
except ImportError:
28+
# define Pin to avoid the error:
29+
# def read(self, pin: Pin, is_differential: bool = False) -> int:
30+
# NameError: name 'Pin' is not defined
31+
Pin = None
2832
pass
2933

3034
_ADS1X15_DEFAULT_ADDRESS = const(0x48)

0 commit comments

Comments
 (0)