Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dkuku/tm1638
nerves driver for tm1638 led controller
https://github.com/dkuku/tm1638
Last synced: about 2 months ago
JSON representation
nerves driver for tm1638 led controller
- Host: GitHub
- URL: https://github.com/dkuku/tm1638
- Owner: dkuku
- Created: 2022-07-26T22:00:41.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-07-26T22:12:23.000Z (over 2 years ago)
- Last Synced: 2024-04-24T02:40:36.310Z (8 months ago)
- Language: Elixir
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TM1638 library for elixir/nerves
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `tm1638` to your list of dependencies in `mix.exs`:```elixir
def deps do
[
{:tm1638, "~> 0.1.0"}
]
end
```## Configration
```
config :tm1638,
stb: 22,
clk: 24,
dio: 23,
brightness: 3
```
or in livebook
```Application.put_env(:tm1638, :stb, 22)
Application.put_env(:tm1638, :clk, 24)
Application.put_env(:tm1638, :dio, 23)
Application.put_env(:tm1638, :brightness, 3)
```## Examples
### iterate over all 8 leds
```
{:ok, tm} = TM1638.init()TM1638.clear_display(tm)
Enum.each(1..255, fn x ->
TM1638.leds(tm, x)
Process.sleep(10)
end)
TM1638.clear_display(tm)
```### read buttons every 100 ms
```
defmodule GetData do
def get() do
{:ok, tm} = TM1638.init()
TM1638.get_data(tm)
end
end
Enum.each(1..100, fn _ ->
:timer.tc(GetData, :get, [])
|> IO.inspect
Process.sleep(100)
end)
```### display moving text
```
TM1638.init()
|> elem(1)
|> TM1638.clear_display()
|> TM1638.display_moving_text("elixir is fun")
|> TM1638.clear_display()
```