Skip to content

Instantly share code, notes, and snippets.

View adkron's full-sized avatar

Amos King adkron

View GitHub Profile
defmodule GrovePi.Buttons do
@moduledoc """
Listen for button presses or releases
Example usage:
iex> {:ok, pid} = GrovePi.start_link
{:ok, #PID<0.172.0>}
iex> GrovePi.Buttons.start_link(pid)
require "securerandom"
require "nokogiri"
module OpenXml
module Parts
class Rels < OpenXml::Part
include Enumerable
def self.parse(xml)
document = Nokogiri::XML(xml)
@adkron
adkron / worker.ex
Last active March 31, 2017 03:00
API idea
defmodule Alarm.Worker do
@moduledoc false
use GenServer
# Pick ports that work on both the GrovePi+ and GrovePi Zero
@button_pin 14 # Port A0
@buzzer_pin 3 # Port D3
def start_link() do
GenServer.start_link(__MODULE__, [])
defmodule GrovePi.I2C do
use GenServer
defmacro __using__(_) do
quote do
@i2c Application.get_env(:grovepi, :i2c, ElixirALE.I2C)
end
end
@type i2c_address :: 0..127
defmodule GrovePi.BuzzerTest do
use ExUnit.Case
@pin 5
setup do
{:ok, _} = GrovePi.Buzzer.start_link(@pin)
GrovePi.I2C.reset(GrovePi.Board)
:ok
defmodule GrovePi.Sound do
use GenServer
@moduledoc """
Listen for events from a GrovePi button. There are two types of
events; pressed and released. When registering for an event the button
will then send a message of `{pin, :pressed}` or `{pin, :released}`.
The button works by polling `GrovePi.Digital` on the pin that you have
registered to a button.

AMOS KING

EXPERIENCE

owner/developer, Binary Noggin - St. James, MO August 2013 - Present

Working closely with customers in agile coaching, product development, and team augmentation. We believe in building amazing software through an understanding of the “why” in the product. We find this “why” through constant communication and trust. Using test driven development and continuous delivery of working software that exceeds expectations and provides constant value is our priority.

AMOS KING

Agile Practitioner | Thought Leader | Web and Embedded Developer

Agile software developer with 10+ years of success working with and leading teams to develop quality software under changing requirements. Able to rapidly utilize new, leading edge technologies. Proven track

AMOS KING

Agile Practitioner | Thought Leader | Web & Embedded Dev

Agile software developer with 10+ years of success working with and leading teams to develop quality software under changing requirements. Able to rapidly utilize new, leading edge technologies. Proven track record in developing trust with customers and within teams.

defmodule GrovePi.Sound.HysteresisTrigger do
@behaviour GrovePi.Trigger
@default_high_threshold 510
@default_low_threshold 490
@moduledoc """
This is the default triggering mechanism for Sound events. Events
are either `loud` or `quiet` and include the trigger state. It
contains to thresholds a `low_threshold` and a `high_threshold` for