diff --git a/README.rst b/README.rst index e9c0d4e..44cb82f 100644 --- a/README.rst +++ b/README.rst @@ -87,6 +87,8 @@ Usage Example print("F6 - 590nm/Yellow %s" % bar_graph(sensor.channel_590nm)) print("F7 - 630nm/Orange %s" % bar_graph(sensor.channel_630nm)) print("F8 - 680nm/Red %s" % bar_graph(sensor.channel_680nm)) + print("Clear %s" % bar_graph(sensor.channel_clear)) + print("Near-IR (NIR) %s" % bar_graph(sensor.channel_nir)) print("\n------------------------------------------------") sleep(1) diff --git a/adafruit_as7341.py b/adafruit_as7341.py index db59fb2..ff00deb 100644 --- a/adafruit_as7341.py +++ b/adafruit_as7341.py @@ -376,7 +376,17 @@ def channel_680nm(self): self._configure_f5_f8() return self._channel_3_data - # TODO: Add clear and NIR accessors + @property + def channel_clear(self): + """The current reading for the clear sensor""" + self._configure_f5_f8() + return self._channel_4_data + + @property + def channel_nir(self): + """The current reading for the NIR (near-IR) sensor""" + self._configure_f5_f8() + return self._channel_5_data def _wait_for_data(self, timeout=1.0): """Wait for sensor data to be ready""" diff --git a/examples/as7341_simpletest.py b/examples/as7341_simpletest.py index 1a52c31..24847a3 100644 --- a/examples/as7341_simpletest.py +++ b/examples/as7341_simpletest.py @@ -23,5 +23,7 @@ def bar_graph(read_value): print("F6 - 590nm/Yellow %s" % bar_graph(sensor.channel_590nm)) print("F7 - 630nm/Orange %s" % bar_graph(sensor.channel_630nm)) print("F8 - 680nm/Red %s" % bar_graph(sensor.channel_680nm)) + print("Clear %s" % bar_graph(sensor.channel_clear)) + print("Near-IR (NIR) %s" % bar_graph(sensor.channel_nir)) print("\n------------------------------------------------") sleep(1)