Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hc-sr501-sensor

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hc-sr501-sensor

Node.js based API for the HC-SR501 motion sensor

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Node.js based API for the HC-SR501 motion detector.

Connect sensor

Import

const { HCSR501 } = require("hc-sr501-motion-sensor")

Constructor HCSR501(sensorPin, delay)

Parameters

  • sensorPin You have to specify the GPIO pin where the sensor is connected to.
  • delay This parameter is optional. You can specify a delay in milliseconds to stop motion detection. The smallest number is 3000.

Example

const sensor = new HCSR501(17, 3000)

sensor.watch((motion) => {
    // motion = boolean
    if(motion) {
        // do something
    } else {
        // do something else
    }
})

FAQs

Package last updated on 13 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc