Skip to content

Commit 4e4ca4d

Browse files
committed
fixing light and play_file for PyPortal
1 parent 31da0f4 commit 4e4ca4d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

adafruit_pybadger/pyportal.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
4343
"""
4444

45+
import board
46+
import analogio
4547
import audioio
4648
from adafruit_pybadger.pybadger_base import PyBadgerBase
4749

@@ -55,6 +57,11 @@ class PyPortal(PyBadgerBase):
5557
_audio_out = audioio.AudioOut
5658
_neopixel_count = 1
5759

60+
def __init__(self):
61+
super().__init__()
62+
63+
self._light_sensor = analogio.AnalogIn(board.LIGHT)
64+
5865
@property
5966
def _unsupported(self):
6067
"""This feature is not supported on PyPortal."""
@@ -63,8 +70,6 @@ def _unsupported(self):
6370
# The following is a list of the features available in other PyBadger modules but
6471
# not available for PyPortal. If called while using a PyPortal, they will result in the
6572
# NotImplementedError raised in the property above.
66-
play_file = _unsupported
67-
light = _unsupported
6873
button = _unsupported
6974

7075

0 commit comments

Comments
 (0)