API for theDFRobot Laser PM2.5 Sensor.
More...
This driver was tested with a DFRobot Laser PM2.5 Sensor. It connects to a UART at 9600 baud. This is the only baud rate supported. It optionally supports Reset and Set/Sleep gpios as well.
while (shouldRun) {
cout << "PM 1 : " << sensor.getPM1() << " ug/m3" << endl;
cout << "PM 2.5: " << sensor.getPM2_5() << " ug/m3" << endl;
cout << "PM 10 : " << sensor.getPM10() << " ug/m3" << endl;
cout << endl;
upm_delay(2);
}
if (shouldRun)
cerr << "Timed out" << endl;
HKA5 |
( |
unsigned int |
uart, |
|
|
int |
set_pin, |
|
|
int |
reset_pin |
|
) |
| |
HKA5 object constructor
- Parameters
-
uart | Specify which uart to use. |
set_pin | Specify the GPIO pin to use for Set. -1 to not use a set pin. |
reset_pin | Specify the GPIO pin to use for Reset. -1 to not use a reset pin. |
- Returns
- an initialized device context on success, NULL on error.
void enable |
( |
bool |
enable | ) |
|
Enable or disable the device. When disabled, the device enters a low power mode and does not emit data. You must have initialized and connected the Set pin for this function to work.
- Parameters
-
enable | true to enable the device, false otherwise. |
Reset the device. You must have initialized and connected the Reset pin for this function to work.
Query the device and store the latest values. You must call this function before calling any of the get*() functions.
Return the last read PM 1.0 value. The value is in micrograms per cubic meter (ug/m3). You must have called the update() function before calling this function.
- Returns
- The value in ug/m3
unsigned int getPM2_5 |
( |
| ) |
|
Return the last read PM 2.5 value. The value is in micrograms per cubic meter (ug/m3). You must have called the update() function before calling this function.
- Returns
- The value in ug/m3
Return the last read PM 10.0 value. The value is in micrograms per cubic meter (ug/m3). You must have called the update() function before calling this function.
- Returns
- The value in ug/m3
The documentation for this class was generated from the following files: