Loom_AS7265X class

AS72625X 3 Spectrum (Visible, near IR, UV) spectral sensor module.

Base classes

class LoomI2CSensor
Abstract root for I2C sensor modules.

Protected variables

AS7265X inst_AS7265X
Underlying AS7265X sensor manager instance.
uint16_t uv
Measured UV bands values. Units: counts / (μW/cm^2)
uint16_t color
Measured color bands values. Units: counts / (μW/cm^2)
uint16_t nir
Measured near-infra-red bands values. Units: counts / (μW/cm^2)
bool use_bulb
Whether or not to use the bulb.
uint8_t gain
Gain setting.
uint8_t mode
Sensor mode.
uint8_t integration_time
Integration time setting.

CONSTRUCTORS / DESTRUCTOR

Loom_AS7265X(LoomManager* manager, const byte i2c_address = 0x49, const uint8_t mux_port = 255, const bool use_bulb = false, const uint8_t gain = 64, const uint8_t mode = AS7265X_MEASUREMENT_MODE_6CHAN_ONE_SHOT, const uint8_t integration_time = 50)
Constructor.
Loom_AS7265X(LoomManager* manager, JsonArrayConst p)
Constructor that takes Json Array, extracts args and delegates to regular constructor.
~Loom_AS7265X() defaulted
Destructor.

OPERATION

void measure() override
Take any relevant measurements.
void package(JsonObject json) override
Package a modules measurements or state.

SETTERS

void enable_bulb(const bool e)
Set whether not bulb is used for active light source.
void set_gain(const uint8_t gain)
Set gain.
void set_mode(const uint8_t mode)
Set mode.
void set_integration_time(const uint8_t time)
Set integration time.

Function documentation

Loom_AS7265X::Loom_AS7265X(LoomManager* manager, const byte i2c_address = 0x49, const uint8_t mux_port = 255, const bool use_bulb = false, const uint8_t gain = 64, const uint8_t mode = AS7265X_MEASUREMENT_MODE_6CHAN_ONE_SHOT, const uint8_t integration_time = 50)

Constructor.

Parameters
manager
i2c_address in Set(Int) | <0x49> | {0x49} | I2C address
mux_port in Int | <255> | [0-16] | Port on multiplexer
use_bulb in Bool | <false> | {true, false} | Whether or not to use bulb
gain in Set(Int) | <1> | { 0("1x"), 1("3.7x"), 2("16x"), 3("64x") } | Gain level
mode in Set(Int) | <3> | { 0("4 channels out of 6"), 1("Different 4 channels out of 6"), 2("All 6 channels continuously"), 3("One-shot reading of all channels") } | Read mode
integration_time in Int | <50> | [0-255] | Integration time (time will be 2.8ms * [integration value])

Loom_AS7265X::Loom_AS7265X(LoomManager* manager, JsonArrayConst p)

Constructor that takes Json Array, extracts args and delegates to regular constructor.

Parameters
manager
in The array of constuctor args to expand

void Loom_AS7265X::package(JsonObject json) override

Package a modules measurements or state.

Parameters
json out Object to put data into

void Loom_AS7265X::print_measurements() const override

Print the last set of measurements taken.

Does not package the data.

void Loom_AS7265X::set_gain(const uint8_t gain)

Set gain.

Parameters
gain in Gain level:

0: 1x (power-on default), 1: 3.7x, 2: 16x, 3: 64x

void Loom_AS7265X::set_mode(const uint8_t mode)

Set mode.

Parameters
mode in Mode

4 channel, other 4 channel, 6 chan, or 6 chan one shot.

void Loom_AS7265X::set_integration_time(const uint8_t time)

Set integration time.

50 * 2.8ms = 140ms. 0 to 255 is valid. (49 is default) If you use Mode 2 or 3 (all the colors) then integration time is double. 140*2 = 280ms between readings.