/      日本語

LTR-308ALS

Illuminance sensor
This is an illuminance sensor that uses the I2C bus.

Processing Flow

  1. Wire.begin(): Initialize the bus
  2. .begin(): Start sensor operation
  3. Wait for 50ms
  4. .available() becomes true
  5. .get_luminance(): Read the value

Required Procedures for Operation

Wire Bus

Before calling the .begin() method, ensure the Wire is initialized using Wire.begin().

Procedures When Waking from Sleep

Ensure the Wire bus is active just before entering sleep (it will automatically recover Wire after waking from sleep).

Method

get_luminance()

uint32_t get_luminance()

Returns the illuminance [lx] as an integer value.

Returns -1 in case of an error.

Common Methods

setup()

void setup()

Allocates memory area for the sensor and performs initialization.

begin(), end()

void begin()
void end()

Starts sensor acquisition. A wait time of about 50ms is required before reading the sensor value.

end() is not supported.

process_ev()

void process_ev(uint32_t arg1, uint32_t arg2 = 0)

For sensors that require wait time processing, provide E_EVENT_TICK_TIMER or E_EVENT_START_UP in arg1 to notify elapsed time. After this method is called and the required time has elapsed, it will become available and the sensor value can be read.

available()

bool available()

Returns true when the sensor satisfies the read condition.

probe()

bool probe()

Returns true when the sensor is connected.