Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

nerves-project/nerves_leds

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nerves.Leds

Build Status Hex version

This project hasn't been maintained in a long time. Either try writing directly to "/sys/class/leds" or see https://github.com/smartrent/delux for a possible replacement.

Simple API to drive leds exposed by linux /sys/class/leds. Designed for use with Nerves, but works on any distribution of Linux with /sys/class/leds.

Installation

Add nerves_leds to your list of dependencies in mix.exs:

def deps do
  [{:nerves_leds, "~> 0.8.1"}]
end

Configuration & Usage

Configure your LEDs mappings:

# config/config.exs
config :nerves_leds, names: [ error: "led0", connect: "led1" ]

Now, you can use predefined states in your app:

alias Nerves.Leds

Leds.set(connect: true)
Leds.set(connect: :heartbeat)
Leds.set(connect: false, error: :slowblink)

You can also define your own states:

# config/config.exs
config :nerves_leds, states: [
    fastblink: [ trigger: "timer", delay_off: 40, delay_on: 30 ],
    blip: [ trigger: "timer", delay_off: 1000, delay_on: 100 ]]

For situations where the number of LEDs are not known at compile time, you can enumerate the LEDs:

Leds.enumerate()

More Details

See the documentation for the full description of the API and configuration.

About

Functions to drive LEDs on embedded systems

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages