Skip to content

mmmries/speedo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Speedo

Measure revolutions by second based on a GPIO pin.

Installation

Add speedo to your list of dependencies in mix.exs:

def deps do
  [
    {:speedo, "~> 0.1.0"}
  ]
end

Then in your supervision tree add a monitor like:

pin_number = 17 # the BCM pin number
children = [
  ...your other children,
  {Speedo.Monitor, pin_number}
]

And finally in whatever part of your application is interested you can call:

Speedo.Monitor.subscribe(pin_number)

And that process will begin receiving messages each time the speed is measured. These messages look like:

{:speedo_rps, pin_number, rps}
# rps is a floating point number representing how many revolutions per second we have most recently measured

About

Measure revolutions per second based on a GPIO pin

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages