Code Monkey home page Code Monkey logo

dsm501's Introduction

DSM501 Arduino Library

Arduino

This Arduino library provides support for working with the DSM501 particulate matter sensor. It allows you to easily interface with the sensor and read particulate matter concentrations.

Table of Contents

Installation

  1. Download this repository as a ZIP file.
  2. In the Arduino IDE, go to Sketch > Include Library > Add .ZIP Library....
  3. Select the downloaded ZIP file.
  4. The library is now installed and ready to use.

Usage

  1. Include the library at the top of your Arduino sketch:

    #include "DSM501.h"
    
  2. Create an instance of the DSM501 class and specify the pin number and an interrupt handler function:

    int sensorPin = 2;  // Replace with your actual sensor pin
    DSM501 dsm501(sensorPin, yourInterruptHandler);
    
  3. Implement your interrupt handler function. This function will be called on each state change of the sensor's output pin:

    void yourInterruptHandler() {
    dsm501.handleInterrupt();
    }
  4. In your Arduino setup() function, initialize the sensor:

    void setup() {
    Serial.begin(9600);
    // Other setup code...
    dsm501.isReady(); // Warm-up the sensor
    }
  5. In your loop, you can read particulate matter concentrations:

    void loop() {
    float pmConcentration = dsm501.readPM();
    // Do something with the concentration value (e.g., display it or send it over a network)
    delay(1000); // Adjust the delay as needed
    }

Example

For a complete example sketch, check the examples folder in this repository.

Contributing

If you would like to contribute to this library, please create a fork of the repository, make your changes, and submit a pull request. Your contributions are greatly appreciated!

License

This library is released under the MIT License.

dsm501's People

Contributors

anemo27 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.