Skip to content

Commit 72c9410

Browse files
authored
Merge pull request #122 from snake48/master
Added function to return only RGB values from the colour sensor
2 parents 91e9c89 + 7a92bbe commit 72c9410

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

sense_hat/colour.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class HardwareInterface:
1515
actual hardware. Using this intermediate layer of abstraction, a
1616
`ColourSensor` object interacts with the hardware without being
1717
aware of how this interaction is implemented.
18-
1918
Different subclasses of the `HardwareInterface` class can provide
2019
access to the hardware through e.g. I2C, `libiio` and its system
2120
files or even a hardware emulator.
@@ -131,7 +130,6 @@ class I2C(HardwareInterface):
131130
"""
132131
An implementation of the `HardwareInterface` for the TCS34725 sensor
133132
that uses I2C to control the sensor and retrieve measurements.
134-
135133
Use the datasheet as a reference: https://ams.com/tcs34725#tab/documents
136134
"""
137135

@@ -351,6 +349,10 @@ def _scaling(self):
351349
def colour(self):
352350
return tuple(reading // self._scaling for reading in self.colour_raw)
353351

352+
@property
353+
def rgb(self):
354+
return tuple(reading // self._scaling for reading in self.colour_raw)[0:3]
355+
354356
color = colour
355357
red = property(lambda self: self.red_raw // self._scaling )
356358
green = property(lambda self: self.green_raw // self._scaling )

0 commit comments

Comments
 (0)