Added new functionality to the class and test.py. The constructor now accepts two parameters:
"timeout" lets you set the serial timeout for the call to serial.Serial() "unit_of_measure" lets return values in different units: microgram/cubic meter (mg/m³) named MassConcentrationEuropean or in particles / 0.01 cubic foot (pcs/0.01cft) named ParticleConcentrationImperial. The latter is calculated by assuming different mean sphere diameters of pm10 or pm2.5 particles. Have a look at http://ir.uiowa.edu/cgi/viewcontent.cgi?article=5915&context=etd for details. Thanks to Teus Hagen the idea and for coding this part. Also added more fine grained logging between standard levels DEBUG and INFO. test.py is new in most cases. It is now callable as a script with parameters. Calling "python test.py" without parameters in a command window will tell how to use. It is based on an idea of Teus Hagen. As a hole test.py and SDS011 class should now work with python2 and python3. Maybe you need to install enum34 (not as enum!) which is a back port of of 3.4 library module supporting IntEnum. Furthermore the exception file is no longer needed, only standard exceptions are used now and there are a lot of language corrections in comments.
Showing with 350 additions and 235 deletions