Module grisp_led

Data Types

color()

color() = color_name() | color_value()

A color as either a shorthand name or a specific RGB value.

color_name()

color_name() = off | black | blue | green | aqua | red | magenta | yellow | white

A color name. off and black are shorthands for turning off the LED.

color_value()

color_value() = {0 | 1, 0 | 1, 0 | 1}

A color value, specifying the individual R, G and B components as 1's or 0's where 1 means on and 0 means off.

pattern()

pattern() = [{time(), color()}]

A list of intervals and colors to show during those intervals.

position()

position() = 1 | 2

The position of the LED on the GRiSP board, either 1 or 2.

time()

time() = pos_integer() | infinity

A time interval for a color in milliseconds. Must be 1 or above, or alternatively infinity.

Function Index

color/2Set the color of an LED.
flash/3Flash an LED in an on/off pattern with the specified color.
off/1Turn of an LED.
pattern/2Animate an LED with a pattern of colors and intervals.

Function Details

color/2

color(Pos::position(), Color::color()) -> ok

Set the color of an LED.

Examples
 1> grisp_led:color(1, red)
 ok
 2> grisp_led:color(2, {0, 1, 0})
 ok

flash/3

flash(Pos::position(), Color::color(), Interval::time()) -> ok

Equivalent to grisp_led:pattern(Position, [{Time, Color}, {Time, off}]).

Flash an LED in an on/off pattern with the specified color.

Examples
 1> grisp_led:flash(2, blue, 500).
 ok

off/1

off(Pos::position()) -> ok

Equivalent to grisp_led:color(Pos, off).

Turn of an LED.

pattern/2

pattern(Pos::position(), Pattern::pattern()) -> ok

Animate an LED with a pattern of colors and intervals.

Examples
 1> grisp_led:flash(1, [{300, green}, {500, yellow}, {700, red}, {infinity, off}]).
 ok
 2> Rainbow = [{300, {R, G, B}} || R <- [0,1], G <- [0,1], B <- [0,1], {R, G, B} =/= {0, 0, 0}].
 [{300,{0,0,1}},
  {300,{0,1,0}},
  {300,{0,1,1}},
  {300,{1,0,0}},
  {300,{1,0,1}},
  {300,{1,1,0}},
  {300,{1,1,1}}]
 3> grisp_led:flash(2, Rainbow).
 ok


Generated by EDoc