Ambient Light Sensor

class APDS9300.APDS9300[source]

Bases: object

Ambient Light Sensor. Class functions for the APDS9300 ambient light sensor.

chipID()[source]

Read the unique chip ID.

Parameters:none
Returns:partID ID of chip
clearInterrupt()[source]

Clear any active interrupts.

Parameters:none
Returns:none
getLuxLevel(ch0, ch1)[source]

Returns LUX output from the raw sensor data.

Parameters:
  • ch0 – Channel 0 value
  • ch1 – Channel 1 value
Returns:

Lux Float value of light intensity

readByte(reg)[source]

Read a byte value from a register.

Parameters:reg – Register address
Returns:Register byte content
readChannel(channel)[source]

Read raw data from channel 0 or channel 1

Parameters:channel – Value of 0 or 1.
Returns:data - Channel data as raw number.
readWord(reg)[source]

Read a word value from a register.

Parameters:reg – Register address
Returns:Register word content
setGain(gain)[source]

Set the gain of the internal photodiode sensors, can be 1x or 16x.

Parameters:gain – Gain type can be GAIN_1 or GAIN_16 for gain of 1 or 16x
Returns:none
setIntHighThreshold(highvalue)[source]

Set the high level data threshold for the interrupt.

Parameters:highvalue – High interrupt threshold value
Returns:none
setIntLowThreshold(lowvalue)[source]

Set the low level data threshold for the interrupt.

Parameters:lowvalue – Low interrupt threshold value
Returns:none
setInterruptState(enable=False)[source]

Enable or disable the interrupts on the sensor.

Parameters:enable – Enables or diable interrupt. Default is False.
Returns:none
setSamplingTime(sampling_time)[source]

Configure the sampling time of the sensor.

Parameters:sampling_time – Can be 0x00,0x01,0x02
Returns:none
setpowerState(state)[source]

Configures the power state of the chip.

Parameters:state – Denotes the power state of the sensor ,set to 0/1 to turn off/on.
Returns:none
writeByte(data)[source]

Write a byte value. Assumes the register pointer is predefined.

Parameters:data – Data byte to write on the I2C bus
Returns:none
writeRegister(reg, data)[source]

Write a byte value to a register.

Parameters:
  • reg – Register address
  • data – Data byte to be written on register.
Returns:

none

writeWord(reg, data)[source]

Write a word value to a register.

Parameters:
  • reg – Register address
  • data – Data word to be written on the register.
Returns:

none

Previous topic

Serial Port for Serial Logging

Next topic

Orange LED

This Page