Class: Artoo::Adaptors::Firmata

Inherits:
Adaptor
  • Object
show all
Defined in:
lib/artoo/adaptors/firmata.rb

Instance Attribute Summary collapse

Attributes inherited from Adaptor

#parent, #port

Instance Method Summary collapse

Methods inherited from Adaptor

#connect_to, #connect_to_serial, #connect_to_tcp, #connect_to_udp, #connected?, #initialize, #reconnect

Constructor Details

This class inherits a constructor from Artoo::Adaptors::Adaptor

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *arguments, &block) ⇒ Object



20
21
22
# File 'lib/artoo/adaptors/firmata.rb', line 20

def method_missing(method_name, *arguments, &block)
  firmata.send(method_name, *arguments, &block)
end

Instance Attribute Details

#firmataObject (readonly)

Returns the value of attribute firmata.



6
7
8
# File 'lib/artoo/adaptors/firmata.rb', line 6

def firmata
  @firmata
end

Instance Method Details

#connectObject



8
9
10
11
12
13
14
# File 'lib/artoo/adaptors/firmata.rb', line 8

def connect
  require 'firmata' unless defined?(::Firmata)
  @firmata = ::Firmata::Board.new(connect_to)
  @firmata.connect
  super
  return true
end

#disconnectObject



16
17
18
# File 'lib/artoo/adaptors/firmata.rb', line 16

def disconnect
  super
end