Git Product home page Git Product logo

gpio-trigger's Introduction

This is a systemd unit for triggering actions based on GPIO events. It uses the gpio command from the wiringpi package to wait for events.

Installation

Run make install. This will:

  • Place [email protected] in /etc/systemd/system
  • Create /etc/gpio-triggers if it does not exist.

Configuration

Create a file in /etc/gpio-triggers named after the BCM GPIO pin number. This file may set any of the following variables:

  • GPIO_COMMAND (required) -- the command to run when the even is triggered.
  • GPIO_PULL (default up) -- this may be up, down, or tri.
  • GPIO_DIR (default falling) -- this may be rising or falling
  • GPIO_DEBOUNCE (default 1.0) -- the number of seconds to wait after triggering an event before triggering the next one.

For example, if I want GPIO4 to trigger a restart, I would create /etc/gpio-triggers/4 with the following content:

GPIO_COMMAND='reboot'

To enable the service, run (as root):

systemctl enable --now gpio-trigger@4

This will trigger a reboot when you connecto GPIO4 to ground.

gpio-trigger's People

Contributors

larsks avatar

Watchers

 avatar James Cloos avatar  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.