+# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
+#
+# SPDX-License-Identifier: MIT
"""
`analogio` - Analog input control
=================================================
try:
from microcontroller.pin import analogIns
except ImportError:
- raise RuntimeError("No Analog Inputs defined for this board")
+ raise RuntimeError("No Analog Inputs defined for this board") from ImportError
class AnalogIn(ContextManaged):
self._channel_path.format(self._channel),
)
- with open(path, "r") as analog_in:
+ with open(path, "r", encoding="utf-8") as analog_in:
return int(analog_in.read().strip())
# pylint: disable=no-self-use