ModularSensors > Classes > Sensor > EverlightALSPT19
ModularSensors > Modules > Everlight ALS-PT19 > EverlightALSPT19


EverlightALSPT19 class

The Sensor sub-class for the Everlight ALS-PT19.

Base classes

class Sensor
The "Sensor" class is used for all sensor-level operations - waking, sleeping, and taking measurements.

Constructors, destructors, conversion operators

EverlightALSPT19(int8_t powerPin, int8_t dataPin, float supplyVoltage, float loadResistor, uint8_t measurementsToAverage = 10)
Construct a new EverlightALSPT19 object with custom supply voltage and loading resistor values.
EverlightALSPT19(uint8_t measurementsToAverage = 10) explicit
Construct a new EverlightALSPT19 object with pins and resistors for the EnviroDIY Mayfly 1.x.
~EverlightALSPT19()
Destroy the EverlightALSPT19 object - no action needed.

Public functions

bool addSingleMeasurementResult(void ) override
Get the results from a single measurement.

Function documentation

EverlightALSPT19(int8_t powerPin, int8_t dataPin, float supplyVoltage, float loadResistor, uint8_t measurementsToAverage = 10)

Construct a new EverlightALSPT19 object with custom supply voltage and loading resistor values.

Parameters
powerPin

The pin on the mcu controlling power to the AOSong ALS-PT19. Use -1 if it is continuously powered.

  • The ALS-PT19 requires a 2.5 - 5.5V power source
dataPin

The processor ADC port pin to read the voltage from the EC probe. Not all processor pins can be used as analog pins. Those usable as analog pins generally are numbered with an "A" in front of the number

  • ie, A1.
supplyVoltage The power supply voltage (in volts) of the ALS-PT19.
loadResistor The size of the loading resistor, in kilaohms (kΩ).
measurementsToAverage The number of measurements to take and average before giving a "final" result from the sensor; optional with a default value of 10.

EverlightALSPT19(uint8_t measurementsToAverage = 10) explicit

Construct a new EverlightALSPT19 object with pins and resistors for the EnviroDIY Mayfly 1.x.

Parameters
measurementsToAverage The number of measurements to take and average before giving a "final" result from the sensor; optional with a default value of 10.

This is a short-cut constructor to help users of our own board so they can change the number of readings without changing other arguments or enter no arguments at all.


bool addSingleMeasurementResult(void ) override

Get the results from a single measurement.

Returns bool True if the function completed successfully.

This asks the sensor for a new result, verifies that it passes sanity range checks, and then adds the value to the result array.

This also un-sets the _millisMeasurementRequested timestamp (sets _millisMeasurementRequested to 0) and updates the _sensorStatus.