Sha256: d9dfe45dde3cd61f08f124f90507fb7d1a3259758510989d72c467f1250a870f

Contents?: true

Size: 833 Bytes

Versions: 3

Compression:

Stored size: 833 Bytes

Contents

#
#
#  Arduino PubSub Hub
#
#
#
require 'serialport'
require 'eventmachine'
require 'stringio'
require 'readline'
require 'logger'
require 'redis'

require 'subduino/ard_io'
require 'subduino/ard_ps'
require 'subduino/parse'
require 'subduino/store'
require 'subduino/arduino'

Thread.current.abort_on_exception = false

module Subduino
  Log = Logger.new("out.log")
  BAUDS = 115200   #BAUDS = 9600
  # BAUDS = [300, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200]
  Sensors = [:temp, :lux]
  # DATA_BITS = 8
  # DATA_STOP = 1


  def self.start(&proc)
    trap(:TERM) { stop! }
    trap(:INT)  { stop! }
    # Start some threads...
    ArdIO.read &proc
    ArdPS.read

    # Be a daemon. Should be a better way..
    # EM.run do; end
  end

  def self.stop!
    ArdIO.stop!
    ArdPS.stop!
    exit 0
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
subduino-0.2.2 lib/subduino.rb
subduino-0.2.1 lib/subduino.rb
subduino-0.2.0 lib/subduino.rb