BlinkOMeter
BlinkOMeter is a project shell for controlling an analog panel meter and an RGB light.
This is the software library for interacting with the BlinkOMeter.
For assembly photos and instructions visit this blog post.
Installation
If available in Hex, the package can be installed
by adding blink_o_meter
to your list of dependencies in mix.exs
:
def deps do
[
{:blink_o_meter, "~> 1.0.0"}
]
end
Configuration
BlinkOMeter supports the following configuration options
config :blink_o_meter,
meter_gpio_pin: 12,
light_gpio_pin: 18,
behavior: :decay,
breath_depth: 50,
breath_length: 3,
meter_decay_rate: 1,
light_decay_rate: 500,
remote_blinkometer_name: :"fw@blinkometer.local",
pigpiox_adapter: Pigpiox,
neopixel_adapter: Neopixel
In addition to globally setting these values in the config each of them can be set at runtime through get_state
and set_state
calls.
meter_gpio_pin
andlight_gpio_pin
- specify the hardware GPIO pins used for each device on the Raaspberry Pi.pigpiox_adapter
andneopixel_adapter
- allow for stubbing out hardware device for local developmentremote_blinkometer_name
- when set in host mode the application will attempt to take over operation of a running blinkometer instance at this addressbehavior
- the various action modes and their configuration are discussed below.
API
The root level API consists of just 4 calls. But further control is present inside each of the UvMeter and WarningLight classes, including the ability to reconfigure the items on the fly using get_state/1
and set_state/1
.
set_meter_level/1
sets - sets the new meter level.increment_meter_level/1
- increases (or decreases) the level by the set amount.set_color/1
- sets the value of each component. Nil values will keep the current component value.increment_color/1
- increases (or decreases) each component of the current colorset_behavior/1
- sets the device mode as described below
Action Modes
Currently BlinkOMeter supports 3 action state: [:static, :decay, :breathe].
static
In static mode the light and meter will stay at whatever you set them.
decay
Under the decay state the values you set for the light intensity and the meter level will approach zero over time. The values for this decay are controlled by the config values meter_decay_rate
and light_decay_rate
. The default values of 500 and 1, are fast for the light and slow for the meter.
config :blink_o_meter,
meter_decay_rate: 1,
light_decay_rate: 500
You could quicken rate of the meter level decay, even at runtime.
BlinkOMeter.Heartbeat.set_state(%{
meter_decay_rate: 100
})
breathe
Breathe mode fades the light intensity in and out in a rhythmic fashion. It can also be configured through the breath_depth
which indicated how bright the light will get on each breath and breath_length
is the rate of breathing.
config :blink_o_meter,
breath_depth: 50,
breath_length: 3,
You could quicken the breathing by changing these variables, even at runtime.
BlinkOMeter.Heartbeat.set_state(%{
breath_depth: 150,
breath_length: 0.5
})