2021-04-10 14:55:38 +00:00
|
|
|
# Introduction
|
|
|
|
|
|
|
|
C# Library for interfacing with the PMS5003 Particulate Matter Sensor.
|
|
|
|
|
|
|
|
For wiring the Sensor consult the [datasheet](https://www.aqmd.gov/docs/default-source/aq-spec/resources-page/plantower-pms5003-manual_v2-3.pdf).
|
|
|
|
|
|
|
|
## Example
|
|
|
|
|
|
|
|
```csharp
|
|
|
|
using System;
|
|
|
|
using System.Threading;
|
|
|
|
|
|
|
|
namespace Application
|
|
|
|
{
|
|
|
|
class Example
|
|
|
|
{
|
|
|
|
static void Main(string[] args)
|
|
|
|
{
|
2022-12-21 16:19:00 +00:00
|
|
|
var pms = new Pms5003("COM3", -1, -1);
|
2021-04-10 14:55:38 +00:00
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
var data = pms.ReadData();
|
|
|
|
Console.WriteLine(data);
|
|
|
|
Thread.Sleep(2000);
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
Console.WriteLine(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|