Skip to content
This repository was archived by the owner on Apr 4, 2021. It is now read-only.

QuentinCG/Arduino-Digital-Sensor-Library

Repository files navigation

Digital Sensor Library for Arduino

Build Status Codacy Badge License: MIT Donate

What is it

This library (with examples) is designed to be integrated in projects using any kind of digital sensor (PIR, sound, piezoelectric, switch, button, ...). It retrieves sensor state with status() (synchronously). It is also possible to attach your own function to sensor state change (asynchronously with interrupt).

How to install

  1. Download latest release

  2. On your Arduino IDE, click "Sketch" menu and then "Include Library > Add .ZIP Libraries"

  3. You can now use the library for your project or launch an example ("File > Examples")

How to connect PIR sensor to your Arduino (sensor used in examples)

PIR sensors have a digital output and a power source entry:

PIR Sensor Arduino
VCC 5V
GND GND
D0 D2 (or any other digital pin)

Important note: If you want to use asynchronous feature of this lib (interrupt), you need to connect the sensor digital output to interrupt compatible pin.

(Source image)

Examples

Two examples are provided with this library:

Show PIR state every second (synchronous)

Link to source code

Show PIR state when it changes (asynchronous with interrupt)

Link to source code

License

This project is under MIT license. This means you can use it as you want (just don't delete the library header).

Contribute

If you want to add more examples or improve the library, just create a pull request with proper commit message and right wrapping.

About

[Done] Digital Sensor Library for Arduino

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages