Class: Artoo::Adaptors::Firmata
- Inherits:
-
Adaptor
- Object
- Adaptor
- Artoo::Adaptors::Firmata
- Defined in:
- lib/artoo/adaptors/firmata.rb
Overview
Connect to Arduino using Firmata
Instance Attribute Summary collapse
-
#firmata ⇒ Object
readonly
Returns the value of attribute firmata.
Instance Method Summary collapse
-
#connect ⇒ Boolean
Creates connection with firmata board.
-
#disconnect ⇒ Boolean
Closes connection with firmata board.
-
#method_missing(method_name, *arguments, &block) ⇒ Object
Uses method missing to call Firmata Board methods.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *arguments, &block) ⇒ Object
Uses method missing to call Firmata Board methods
29 30 31 |
# File 'lib/artoo/adaptors/firmata.rb', line 29 def method_missing(method_name, *arguments, &block) firmata.send(method_name, *arguments, &block) end |
Instance Attribute Details
#firmata ⇒ Object (readonly)
Returns the value of attribute firmata.
8 9 10 |
# File 'lib/artoo/adaptors/firmata.rb', line 8 def firmata @firmata end |
Instance Method Details
#connect ⇒ Boolean
Creates connection with firmata board
12 13 14 15 16 17 18 19 |
# File 'lib/artoo/adaptors/firmata.rb', line 12 def connect require 'firmata' unless defined?(::Firmata::Board) @firmata = ::Firmata::Board.new(connect_to) @firmata.connect super return true end |
#disconnect ⇒ Boolean
Closes connection with firmata board
23 24 25 |
# File 'lib/artoo/adaptors/firmata.rb', line 23 def disconnect super end |