Sha256: a34cd6d93037f2df7c1ddc2e956f963145294084f1426582a6fab1a752fba277

Contents?: true

Size: 554 Bytes

Versions: 2

Compression:

Stored size: 554 Bytes

Contents

require 'whipped-cream/control'

module WhippedCream
  # A Button represents a one-time action, such as momentarily turning on a
  # pin, or sending a message to an object
  class Button < Control
    attr_reader :name, :pin, :block

    def initialize(name, options = {})
      raise "Invalid pin.  The pin must be one of "\
            "the Raspberry Pi's valid GPIO pins: "\
            "#{VALID_GPIO_PINS}" unless VALID_GPIO_PINS.include?(options[:pin])

      @name = name
      @pin = options[:pin]
      @block = options[:block]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
whipped-cream-0.2.0.beta1 lib/whipped-cream/button.rb
whipped-cream-0.1.1 lib/whipped-cream/button.rb