# `Delux.Pattern`
[🔗](https://github.com/elixir-circuits/delux/blob/v0.4.2/lib/delux/pattern.ex#L5)

Utility functions for handling element sequences for one LED

# `element`

```elixir
@type element() :: {Delux.RGB.component(), milliseconds()}
```

Value, duration for one component

Values are 0 to 1 and durations are in milliseconds.

# `milliseconds`

```elixir
@type milliseconds() :: non_neg_integer()
```

Integer durations in milliseconds

# `t`

```elixir
@type t() :: [element()]
```

A sequence of elements

These get processed into the pattern string that's sent to Linux.

# `forever_ms`

```elixir
@spec forever_ms() :: 3_600_000
```

Return a number of ms that should be considered a long time

Linux doesn't support an infinite timeout, so use this value instead.

# `pwm`

```elixir
@spec pwm(t(), 0..100) :: t()
```

PWM a sequence of elements

The resulting sequence will only be fully on or fully off. See
caveats in `Program.adjust_brightness_pwm/2`.

IMPORTANT: This function is VERY incomplete right now. It requires
much more thought to work around flickering issues at low PWM rates.

# `simplify`

```elixir
@spec simplify(t()) :: t()
```

Reduce the number of transitions in a sequence

This reduces the length of the pattern and in some cases makes it
use less of the CPU to run. It's useful for programmatically
generated patterns that can take inputs that generate lots
of repeating sequences.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
