No commit activity in last 3 years
No release in over 3 years
A Humble RPi plugin to monitor ambient light levels.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.1.0, ~> 0.1
 Project Readme

Introducing the Humble_Rpi-plugin-photocell gem

Testing the gem

require 'humble_rpi-plugin-photocell'

class Echo

  def notice(s)
    puts "%s: %s" % [Time.now, s]
  end
end

rpi = HumbleRPiPluginPhotocell.new(settings: {channel: 0}, variables: {notifier: Echo.new})
rpi.start

Output:

ready to monitor photocell
2016-02-19 20:52:12 +0000: pi/photocell: 921
2016-02-19 20:54:14 +0000: pi/photocell: 646

When the room light was switched off the photocell registered 921, and when the light was switched on again, the photocell registered 646.

Using the plugin with the Humble RPi gem

require 'humble_rpi'
require 'humble_rpi-plugin-photocell'

r = HumbleRPi.new device_name: 'ottavia', sps_address: '192.168.4.140',\
  plugins: {Photocell: {channel: 0} }
r.start

Resources

humblerpiphotocell gem photocell humblerpi