science_jubilee.tools.AS7341 ============================ .. py:module:: science_jubilee.tools.AS7341 Classes ------- .. autoapisummary:: science_jubilee.tools.AS7341.AS7341 Module Contents --------------- .. py:class:: AS7341(index, name, config) Bases: :py:obj:`science_jubilee.tools.Tool.Tool` A class representation of the AS7341 spectral sensor. :param Tool: The base tool class :type Tool: :class:`Tool` .. py:attribute:: lineEnding :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ """ .. raw:: html
.. py:attribute:: baudrate :value: 115200 .. py:attribute:: sensor_config :value: None .. py:attribute:: serial_port :value: None .. py:method:: load_config(config) Loads the configuration file for the AS7341 sensor tool .. py:method:: find_seeed() -> List[serial.Serial] Find all Seeed Studio or Espressif devices connected to the system :return: List of serial ports for connected Seeed devices :rtype: List[serial.Serial] :raises IOError: If no Seeed devices are found .. py:method:: connect_seeed(ser_port_index: int = 0) -> serial.Serial Connect to a Seeed device at the specified port index :param ser_port_index: Index of the serial port to connect to, defaults to 0 :type ser_port_index: int, optional :return: Connected serial port :rtype: serial.Serial .. py:method:: disconnect_seeed() -> bool Disconnect from the currently connected Seeed device :return: True if disconnection was successful :rtype: bool .. py:method:: blink(cmd: Union[int, str]) -> None Send a blink command to the connected Seeed device :param cmd: The blink command parameter :type cmd: Union[int, str] :raises ToolStateError: If no serial port is connected .. py:method:: measure_spectrum(duty_cycle: int = 100) -> Dict[str, Any] Measure the spectral values from the AS7341 sensor :param duty_cycle: The duty cycle for the measurement (0-100), defaults to 100 :type duty_cycle: int, optional :return: Dictionary containing the spectral readings from different channels :rtype: Dict[str, Any] :raises ToolStateError: If no serial port is connected :raises ValueError: If duty cycle is out of range .. py:method:: get_raw_spectrum(duty_cycle: int = 100) -> str Get the raw spectral data string from the AS7341 sensor :param duty_cycle: The duty cycle for the measurement (0-100), defaults to 100 :type duty_cycle: int, optional :return: Raw string output from the sensor :rtype: str :raises ToolStateError: If no serial port is connected