Project

pi_sensor

0.0
No commit activity in last 3 years
No release in over 3 years
Use Ruby to talk to a bunch of sensors with your Raspberry Pi.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

PiSensor

TODO: Write a gem description

Installation

Add this line to your application's Gemfile:

gem 'pi_sensor'

And then execute:

$ bundle

Or install it yourself as:

$ gem install pi_sensor

A note about pin numbering

Raspberry Pi pin numbering can be confusing. The pin numbers used in this library are the wiringPi pin numbers: https://projects.drogon.net/raspberry-pi/wiringpi/pins

Usage

Here's an example using the SHT15 temperture/humidty sensor. Note that you need to run this code as root or with sudo:

require 'pi_sensor'

# Connects Pi physical pin 11 to SCK and Pi physical pin 12 to DATA
sensor = PiSensor::SHT15.new :clock => 0, :data => 1

# And then simply query for the temperature and humidity
puts " Temperature: #{sensor.temperature}°C"
puts "    Humidity: #{sensor.humidity}%"

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request