science_jubilee.tools.AS7341#
Classes#
A class representation of the AS7341 spectral sensor. |
Module Contents#
- class science_jubilee.tools.AS7341.AS7341(index, name, config)[source]#
Bases:
science_jubilee.tools.Tool.ToolA class representation of the AS7341 spectral sensor.
- Parameters:
Tool (
Tool) – The base tool class
- find_seeed() List[serial.Serial][source]#
Find all Seeed Studio or Espressif devices connected to the system
- Returns:
List of serial ports for connected Seeed devices
- Return type:
List[serial.Serial]
- Raises:
IOError – If no Seeed devices are found
- connect_seeed(ser_port_index: int = 0) serial.Serial[source]#
Connect to a Seeed device at the specified port index
- Parameters:
ser_port_index (int, optional) – Index of the serial port to connect to, defaults to 0
- Returns:
Connected serial port
- Return type:
serial.Serial
- disconnect_seeed() bool[source]#
Disconnect from the currently connected Seeed device
- Returns:
True if disconnection was successful
- Return type:
- blink(cmd: int | str) None[source]#
Send a blink command to the connected Seeed device
- Parameters:
- Raises:
ToolStateError – If no serial port is connected
- measure_spectrum(duty_cycle: int = 100) Dict[str, Any][source]#
Measure the spectral values from the AS7341 sensor
- Parameters:
duty_cycle (int, optional) – The duty cycle for the measurement (0-100), defaults to 100
- Returns:
Dictionary containing the spectral readings from different channels
- Return type:
Dict[str, Any]
- Raises:
ToolStateError – If no serial port is connected
ValueError – If duty cycle is out of range
- get_raw_spectrum(duty_cycle: int = 100) str[source]#
Get the raw spectral data string from the AS7341 sensor
- Parameters:
duty_cycle (int, optional) – The duty cycle for the measurement (0-100), defaults to 100
- Returns:
Raw string output from the sensor
- Return type:
- Raises:
ToolStateError – If no serial port is connected