adafruit / adafruit_circuitpython_as7341 Goto Github PK
View Code? Open in Web Editor NEWCircuitPython library for use with the Adafruit AS7341 breakout
License: MIT License
CircuitPython library for use with the Adafruit AS7341 breakout
License: MIT License
Maybe instead formalize second parameter on request to namedtuple as a square bracketed list of string items or as a string containing items delimited by comma space? Maybe CircuitPython can't handle the necessary string to list conversion.
Am attempting to implement software based spectroscope for educational demonstrations using Adafruit # 3500 Trinket M0 connected to Adafruit # 4698 AS7341 breakout.
First time submitting regarding Adafruit offerings. Please let me know if my style and content are conformant to expectations.
Is there a way to get a reading from the Clear and NIR channels on the AS7341? On line 379 of 'adafruit_as7341.py' it is still listed as a TODO. Is this still something that is planning on being added? Thanks so much!
Add a Basic DisplayIO Based Example
We would like to have a basic displayio example for this library. The example should be written for microcontrollers with a built-in display. At a minimum it should show a Label on the display and update it with live readings from the sensor.
The example should not be overly complex, it's intended to be a good starting point for displayio based projects that utilize this sensor library. Try to keep all visual content as near to the top left corner as possible in order to best fascilitate devices with small built-in display resolutions.
The new example should follow the naming convention examples/libraryname_displayio_simpletest.py
with "libraryname" being replaced by the actual name of this library.
You can find an example of a Pull Request that adds this kind of example here: adafruit/Adafruit_CircuitPython_BME680#72
We have a guide that covers the process of contributing with git and github: https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github
If you're interested in contributing but need additional help, or just want to say hi, feel free to join the Discord server to ask questions: https://adafru.it/discord
The documentation now says types astep
and atime
correctly for linters, but not so well for library usage (since the __get__()
and __set__()
methods mean the actual return values are different. Not sure the correct fix, but wanted to document it for now at least.
There are missing type annotations for some functions in this library.
The typing
module does not exist on CircuitPython devices so the import needs to be wrapped in try/except to catch the error for missing import. There is an example of how that is done here:
try:
from typing import List, Tuple
except ImportError:
pass
Once imported the typing annotations for the argument type(s), and return type(s) can be added to the function signature. Here is an example of a function that has had this done already:
def wrap_text_to_pixels(
string: str, max_width: int, font=None, indent0: str = "", indent1: str = ""
) -> List[str]:
If you are new to Git or Github we have a guide about contributing to our projects here: https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github
There is also a guide that covers our CI utilities and how to run them locally to ensure they will pass in Github Actions here: https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/check-your-code In particular the pages: Sharing docs on ReadTheDocs
and Check your code with pre-commit
contain the tools to install and commands to run locally to run the checks.
If you are attempting to resolve this issue and need help, you can post a comment on this issue and tag both @FoamyGuy and @kattni or reach out to us on Discord: https://adafru.it/discord in the #circuitpython-dev
channel.
The following locations are reported by mypy to be missing type annotations:
The docstring says: """Resets the internal registers and restores the default settings"""
, but the function is empty.
Apologies if this is on the todo list already.
I tried toggling self._power_enabled
as a quick workaround, but previous values persisted.
Hello,
I am using this code with the AS7341 and a Raspberrypi. I am trying to calibrate the sensor readings with a Spectrometer and I have faced an issue. It seems that the F5-F8 channel readings are incorrect. To verify that it is not a sensor limitation issue, I compared the readings with the readings of the same sensor connected to an Arduino using c++ code (https://github.com/adafruit/Adafruit_AS7341/blob/master/Adafruit_AS7341.cpp). The ATIME, AGAIN, and ASTEP parameters are kept the same in both platforms. The values for the F5-F8 are completely different and those that are obtained with the c++ code are consistent with the actual spectrometer. I cannot day I fully understand the code, but I am guessing something is going wrong in the SMUX config in "_f5f8_clear_nir()". Would anyone please be able to provide some insight into this?
sparks-baird/self-driving-lab-demo#17
Is this as simple as:
i2c = board.I2C()
sensor = AS7341(i2c)
sensor.astep = 10
sensor.atime = 100
(similar to the flicker detection example, modifying the property after class instantiation)
Also, what are the default values for these?
Setting the LED current to 0, with sensor.led_current=0 gives the unexpected result of actually setting the current to the maximum value possible, due to wrap around in the calculation.
Suggest modifying line 620 of file to:
new_current = max(0, min(127,int((led_curent - 4) / 1)))
to coerce current being set to valid range.
regards
dave Langstaff
How can I get the clear channel reading?
The syntax here:
Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit QT Py M0 with samd21e18
>>> from collections import namedtuple
>>> foo = namedtuple("foo", "x y z")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: object 'str' is not a tuple or list
>>> foo = namedtuple("foo", ("x","y","z"))
>>>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.