-
Notifications
You must be signed in to change notification settings - Fork 22
Update to the test file of the TCS34725 color sensor #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to the test file of the TCS34725 color sensor #37
Conversation
@SilviaCC The CI is failing on Black and Pylint, could you make sure you've run Pylint and Black locally on your code. You can do this manually or using pre-commit. Instructions are available here: https://adafru.it/check-your-code Thanks :) |
@silviaCCI have just saw you comment in the discord channel, ping me if you need any help.. |
@jposada202020 If you could message me in discord, I would really appreciate the help, thank you! |
@SilviaCC so right know the CI is only complaining about black, this is fairly easy to solve if we run black on the files. could you try it, also what I would do in the meantime is that I will grab your files and do the same.. |
@SilviaCC according to the changes. you could change the # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
# Simple demo of the TCS34725 color sensor.
# Will detect the color from the sensor and print it out every second.
import time
import board
import adafruit_tcs34725
# Create sensor object, communicating over the board's default I2C bus
i2c = board.I2C() # uses board.SCL and board.SDA
sensor = adafruit_tcs34725.TCS34725(i2c)
# Change sensor integration time to values between 2.4 and 614.4 milliseconds
# sensor.integration_time = 150
# Change sensor gain to 1, 4, 16, or 60
# sensor.gain = 4
# Main loop reading color and printing it every second.
while True:
# Raw data from the sensor in a 4-tuple of red, green, blue, clear light component values
# print(sensor.color_raw)
color = sensor.color
color_rgb = sensor.color_rgb_bytes
print(
"RGB color as 8 bits per channel int: #{0:02X} or as 3-tuple: {1}".format(
color, color_rgb
)
)
# Read the color temperature and lux of the sensor too.
temp = sensor.color_temperature
lux = sensor.lux
print("Temperature: {0}K Lux: {1}\n".format(temp, lux))
# Delay for a second and repeat.
time.sleep(1.0) |
Thanks @SilviaCC |
Well, this was ... fun... :D I hope all is good now, lol |
Looks good! Thanks @SilviaCC ! Yes, isn't pleasing the CI bots a ton of fun. |
@SilviaCC Thank you very much, if you need any help regarding any other PR let me know. Thanks Again for your contribution |
Updating https://github.com/adafruit/Adafruit_CircuitPython_OV2640 to 1.0.1 from 1.0.0: > Merge pull request adafruit/Adafruit_CircuitPython_OV2640#3 from adafruit/ulab-example Updating https://github.com/adafruit/Adafruit_CircuitPython_SSD1306 to 2.12.0 from 2.11.6: > Merge pull request adafruit/Adafruit_CircuitPython_SSD1306#66 from mcauser/patch Updating https://github.com/adafruit/Adafruit_CircuitPython_TCS34725 to 3.3.8 from 3.3.7: > Merge pull request adafruit/Adafruit_CircuitPython_TCS34725#37 from silviaCC/simpletest_and_color_rgb_update > Moved default branch to main > Moved CI to Python 3.7 > Added help text and problem matcher > Added pull request template Updating https://github.com/adafruit/Adafruit_CircuitPython_Display_Text to 2.18.6 from 2.18.5: > Merge pull request adafruit/Adafruit_CircuitPython_Display_Text#153 from lesamouraipourpre/max-size Updating https://github.com/adafruit/Adafruit_CircuitPython_Simple_Text_Display to 1.0.2 from 1.0.1: > Merge pull request adafruit/Adafruit_CircuitPython_Simple_Text_Display#2 from kattni/pypi Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA: > Added the following libraries: Adafruit_CircuitPython_Simple_Text_Display
Added more examples of how to read the data form the color sensor in
tcs34725_simpletest.py.
Also added a comment explaining the gamma correction calculations that are done on the raw values from the sensor in
color_rgb_bytes
fromadafruit_tcs34725.py
.