Functions to drive LEDs on embedded systems
Switch branches/tags
Clone or download
fhunleth and mobileoverlord Remove unneeded applications list update; fix typos (#16)
The applications part isn't needed any more with Elixir 1.4.
Latest commit 4206b3b Aug 4, 2017

README.md

Nerves.Leds

Build Status Hex version Ebert

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

If available in Hex, the package can be installed as:

  1. Add nerves_leds to your list of dependencies in mix.exs:
def deps do
  [{:nerves_leds, "~> 0.8.0"}]
end
  1. Run mix deps.get and mix compile

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 ]]

More Details

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