upm  0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
Public Member Functions

API for the PPD42NS Dust Sensor. More...

Detailed Description

UPM module for the PPD42NS dust sensor

ppd42ns.jpg
// Instantiate a dust sensor on GPIO pin D8
upm::PPD42NS* dust = new upm::PPD42NS(8);
cout << "This program will give readings every 30 seconds until you stop it" << endl;
while (shouldRun)
{
data = dust->getData();
cout << "Low pulse occupancy: " << data.lowPulseOccupancy << endl;
cout << "Ratio: " << data.ratio << endl;
cout << "Concentration: " << data.concentration << endl;
}

Public Member Functions

 PPD42NS (int pin)
 
 ~PPD42NS ()
 
dustData getData ()
 

Constructor & Destructor Documentation

PPD42NS ( int  pin)

PPD42NS constructor

Parameters
pinDigital pin to use
~PPD42NS ( )

PPD42NS destructor

Member Function Documentation

dustData getData ( )

Prints dust concentration

Returns
struct dustData Contains data from the dust sensor

The documentation for this class was generated from the following files: