{"id":20499303,"url":"https://github.com/phillippohlandt/bright_pi","last_synced_at":"2025-04-13T18:51:20.678Z","repository":{"id":62430828,"uuid":"503391226","full_name":"PhillippOhlandt/bright_pi","owner":"PhillippOhlandt","description":"BrightPi is an Elixir library to talk to the \"Pi Supply Bright Pi\" LED board","archived":false,"fork":false,"pushed_at":"2022-06-16T19:56:58.000Z","size":21,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-09-16T17:46:22.827Z","etag":null,"topics":["bright-pi","elixir","hardware","i2c","led","nerves","pi-supply","raspberry-pi"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/bright_pi","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PhillippOhlandt.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-14T14:19:50.000Z","updated_at":"2024-01-04T11:50:11.000Z","dependencies_parsed_at":"2022-11-01T20:30:48.545Z","dependency_job_id":null,"html_url":"https://github.com/PhillippOhlandt/bright_pi","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhillippOhlandt%2Fbright_pi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhillippOhlandt%2Fbright_pi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhillippOhlandt%2Fbright_pi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhillippOhlandt%2Fbright_pi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PhillippOhlandt","download_url":"https://codeload.github.com/PhillippOhlandt/bright_pi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248765982,"owners_count":21158296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bright-pi","elixir","hardware","i2c","led","nerves","pi-supply","raspberry-pi"],"created_at":"2024-11-15T18:17:03.079Z","updated_at":"2025-04-13T18:51:20.657Z","avatar_url":"https://github.com/PhillippOhlandt.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BrightPi\n\n![Test Status](https://github.com/PhillippOhlandt/bright_pi/actions/workflows/tests.yml/badge.svg)\n![Latest Version](https://img.shields.io/hexpm/v/bright_pi.svg)\n\nBrightPi is a library to talk to the [Pi Supply Bright Pi](https://uk.pi-supply.com/products/bright-pi-bright-white-ir-camera-light-raspberry-pi) board\nfeaturing 4 white LEDs and 4 pairs of two infrared LEDs.\n\nThis library can control the on/off value of each LED or LED pair,\nas well as their dim value and a global gain value.\n\n## Examples\n\n```elixir\n# Turn all white LEDs on\niex\u003e BrightPi.set_leds([1, 2, 3, 4])\n{:ok, [1, 2, 3, 4]}\n\n# Turn all infrared LEDs on\niex\u003e BrightPi.set_leds([5, 6, 7, 8])\n{:ok, [5, 6, 7, 8]}\n\n# Dim some LEDs\niex\u003e BrightPi.set_leds_dim([1, 2, 3, 4], 10)\n{:ok, [10, 10, 10, 10, 1, 1, 1, 1]}\n\n# Set gain for all LEDs\niex\u003e BrightPi.set_gain(10)\n{:ok, 10}\n```\n\n## Installation\n\nThe package can be installed\nby adding `bright_pi` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:bright_pi, \"~\u003e 1.0\"}\n  ]\nend\n```\n\n## Setup\n\nIn order to use the library, the board process needs to be added to the supervision tree.\n\n```elixir\ndefmodule MyApp.Application do\n  use Application\n\n  @impl true\n  def start(_type, _args) do\n    children = [\n      BrightPi.board()\n    ]\n    \n    opts = [strategy: :one_for_one, name: MyApp.Supervisor]\n    Supervisor.start_link(children, opts)\n  end\nend\n```\n\nBy default, the `BrightPi.board/0` helper function returns the `BrightPi.Board`\nmodule which talks to the real LED board over I2C.\n\nFor local development, the `BrightPi.VirtualBoard` module can be configured via application configuration:\n\n```elixir\n# config/host.exs\n\nconfig :bright_pi, board: BrightPi.VirtualBoard\n```\n\nThe `BrightPi.VirtualBoard` module mocks all the functionality of the real LED board.\n\nDepending on the application setup,\neach board can also be started explicitly in the supervision tree,\nas long as the proper board is set via configuration in each environment.\n\nThe whole documentation can be found at [https://hexdocs.pm/bright_pi](https://hexdocs.pm/bright_pi).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphillippohlandt%2Fbright_pi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphillippohlandt%2Fbright_pi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphillippohlandt%2Fbright_pi/lists"}