artoo-arduino 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/Gemfile.lock +7 -7
- data/artoo-arduino.gemspec +3 -3
- data/examples/firmata_blink_led.rb +17 -0
- data/examples/firmata_blink_led_with_toggle.rb +18 -0
- data/examples/firmata_button_and_led.rb +16 -0
- data/examples/firmata_led_brightness.rb +29 -0
- data/examples/firmata_motor.rb +28 -0
- data/examples/firmata_servo.rb +21 -0
- data/examples/firmata_wiichuck.rb +13 -0
- data/lib/artoo/adaptors/firmata.rb +2 -1
- data/lib/artoo/drivers/button.rb +3 -3
- data/lib/artoo/drivers/led.rb +26 -13
- data/lib/artoo/drivers/motor.rb +5 -5
- data/lib/artoo/drivers/servo.rb +2 -2
- data/lib/artoo/drivers/wiidriver.rb +1 -1
- data/lib/artoo-arduino/version.rb +1 -1
- data/test/drivers/led_test.rb +75 -31
- data/test/test_helper.rb +1 -1
- metadata +14 -8
- data/examples/button_and_led.rb +0 -9
- data/examples/firmata.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 665324f8bb8bec3f5156fe6355b23553fb12a20b
|
4
|
+
data.tar.gz: 65b647f2653f2959f0a0aa2aee8fad3ccbab3816
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3724ae43dd73311c9c0e2371d74bb2e52833d91ca7dd79b6ac0fcbad1ee4c919bdff4e5290c5f58f7f22e1638332b040e1b7d34981b02c70fcdefc8221012a43
|
7
|
+
data.tar.gz: e274f06285b6c4be343ddbf684519e636d8c7acfbd66bb32e1bc9737de74792e0fbfb0cb69faf5b18db3948c89fc993f75d9e020f5bf3ad0cc31e28dd3d00d2a
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
artoo-arduino (1.0.
|
5
|
-
artoo (~> 1.0.0
|
6
|
-
hybridgroup-firmata (~> 0.4.
|
4
|
+
artoo-arduino (1.0.2)
|
5
|
+
artoo (~> 1.0.0)
|
6
|
+
hybridgroup-firmata (~> 0.4.3)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
-
artoo (1.0.0
|
11
|
+
artoo (1.0.0)
|
12
12
|
celluloid (~> 0.14.1)
|
13
13
|
celluloid-io (~> 0.14.1)
|
14
14
|
multi_json (~> 1.6)
|
@@ -23,13 +23,13 @@ GEM
|
|
23
23
|
nio4r (>= 0.4.5)
|
24
24
|
certified (0.1.1)
|
25
25
|
coderay (1.0.9)
|
26
|
-
|
26
|
+
event_emitter (0.2.5)
|
27
27
|
http (0.4.0)
|
28
28
|
certified
|
29
29
|
http_parser.rb
|
30
30
|
http_parser.rb (0.5.3)
|
31
|
-
hybridgroup-firmata (0.4.
|
32
|
-
|
31
|
+
hybridgroup-firmata (0.4.3)
|
32
|
+
event_emitter
|
33
33
|
metaclass (0.0.1)
|
34
34
|
method_source (0.8.2)
|
35
35
|
minitest (5.0.1)
|
data/artoo-arduino.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = "artoo-arduino"
|
7
7
|
s.version = Artoo::Arduino::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors = ["Ron Evans", "Adrian Zankich"]
|
9
|
+
s.authors = ["Ron Evans", "Adrian Zankich", "Rafael Magaña"]
|
10
10
|
s.email = ["artoo@hybridgroup.com"]
|
11
11
|
s.homepage = "https://github.com/hybridgroup/artoo-arduino"
|
12
12
|
s.summary = %q{Artoo adaptor and driver for Arduino}
|
@@ -19,8 +19,8 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
|
22
|
-
s.add_runtime_dependency 'artoo', '~> 1.0.0
|
23
|
-
s.add_runtime_dependency 'hybridgroup-firmata', '~> 0.4.
|
22
|
+
s.add_runtime_dependency 'artoo', '~> 1.0.0'
|
23
|
+
s.add_runtime_dependency 'hybridgroup-firmata', '~> 0.4.3'
|
24
24
|
s.add_development_dependency 'minitest', '~> 5.0'
|
25
25
|
s.add_development_dependency 'minitest-happy'
|
26
26
|
s.add_development_dependency 'mocha', '~> 0.14.0'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'artoo'
|
2
|
+
|
3
|
+
# Circuit and schematic here: http://arduino.cc/en/Tutorial/Blink
|
4
|
+
|
5
|
+
#connection :firmata, :adaptor => :firmata, :port => '/dev/tty*'
|
6
|
+
connection :firmata, :adaptor => :firmata, :port => '127.0.0.1:8023'
|
7
|
+
device :board
|
8
|
+
device :led, :driver => :led, :pin => 13
|
9
|
+
|
10
|
+
work do
|
11
|
+
puts "Firmware name: #{board.firmware_name}"
|
12
|
+
puts "Firmata version: #{board.version}"
|
13
|
+
|
14
|
+
every 1.second do
|
15
|
+
led.on? ? led.off : led.on
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'artoo'
|
2
|
+
|
3
|
+
# Circuit and schematic here: http://arduino.cc/en/Tutorial/Blink
|
4
|
+
|
5
|
+
#connection :firmata, :adaptor => :firmata, :port => '/dev/tty*'
|
6
|
+
connection :firmata, :adaptor => :firmata, :port => '127.0.0.1:8023'
|
7
|
+
device :board
|
8
|
+
device :led, :driver => :led, :pin => 13
|
9
|
+
|
10
|
+
work do
|
11
|
+
puts "Firmware name: #{board.firmware_name}"
|
12
|
+
puts "Firmata version: #{board.version}"
|
13
|
+
|
14
|
+
every 1.second do
|
15
|
+
led.toggle
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'artoo'
|
2
|
+
|
3
|
+
# Circuit and schematic here: http://arduino.cc/en/tutorial/button
|
4
|
+
|
5
|
+
#connection :firmata, :adaptor => :firmata, :port => '/dev/tty*'
|
6
|
+
connection :firmata, :adaptor => :firmata, :port => '127.0.0.1:8023'
|
7
|
+
device :led, :driver => :led, :pin => 13
|
8
|
+
device :button, :driver => :button, :pin => 2, :interval => 0.01
|
9
|
+
|
10
|
+
work do
|
11
|
+
puts
|
12
|
+
puts "Press the button connected on pin #{button.pin}..."
|
13
|
+
|
14
|
+
on button, :push => proc { led.on }
|
15
|
+
on button, :release => proc { led.off }
|
16
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'artoo'
|
2
|
+
|
3
|
+
# Circuit and schematic here: http://arduino.cc/en/Tutorial/Fade
|
4
|
+
|
5
|
+
#connection :firmata, :adaptor => :firmata, :port => '/dev/tty*'
|
6
|
+
connection :firmata, :adaptor => :firmata, :port => '127.0.0.1:8023'
|
7
|
+
device :board
|
8
|
+
device :led, :driver => :led, :pin => 3
|
9
|
+
|
10
|
+
brightness = 0
|
11
|
+
fade_amount = 5
|
12
|
+
|
13
|
+
|
14
|
+
work do
|
15
|
+
|
16
|
+
puts "Firmware name: #{board.firmware_name}"
|
17
|
+
puts "Firmata version: #{board.version}"
|
18
|
+
|
19
|
+
led.on
|
20
|
+
|
21
|
+
every(0.05) do
|
22
|
+
led.brightness(brightness)
|
23
|
+
brightness = brightness + fade_amount
|
24
|
+
if brightness == 0 or brightness == 255
|
25
|
+
fade_amount = -fade_amount
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'artoo'
|
2
|
+
|
3
|
+
leg1_pin = 7 # digital pin
|
4
|
+
leg2_pin = 4 # digital pin
|
5
|
+
speed_pin = 3 # PWM pin
|
6
|
+
|
7
|
+
speed = 0
|
8
|
+
forward = true
|
9
|
+
|
10
|
+
#connection :firmata, :adaptor => :firmata, :port => '/dev/tty*'
|
11
|
+
connection :firmata, :adaptor => :firmata, :port => '127.0.0.1:8023'
|
12
|
+
device :board
|
13
|
+
device :motor, :driver => :motor, :pin => [leg1_pin, leg2_pin, speed_pin]
|
14
|
+
|
15
|
+
work do
|
16
|
+
puts "Firmware name: #{board.firmware_name}"
|
17
|
+
puts "Firmata version: #{board.version}"
|
18
|
+
|
19
|
+
every(0.1)do
|
20
|
+
forward ? motor.forward(speed) : motor.backward(speed)
|
21
|
+
speed += 10
|
22
|
+
if speed >= 255
|
23
|
+
speed = 0
|
24
|
+
forward = (not forward)
|
25
|
+
sleep 1 # give the motor some time to stop inertia
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'artoo'
|
2
|
+
|
3
|
+
# Circuit and schematic here: http://arduino.cc/en/Tutorial/Sweep
|
4
|
+
|
5
|
+
#connection :firmata, :adaptor => :firmata, :port => '/dev/tty*'
|
6
|
+
connection :firmata, :adaptor => :firmata, :port => '127.0.0.1:8023'
|
7
|
+
device :board
|
8
|
+
device :servo, :driver => :servo, :pin => 3 # pin must be a PWM pin
|
9
|
+
|
10
|
+
work do
|
11
|
+
puts "Firmware name: #{board.firmware_name}"
|
12
|
+
puts "Firmata version: #{board.version}"
|
13
|
+
|
14
|
+
every(2) do
|
15
|
+
case servo.current_angle
|
16
|
+
when 90 then servo.max
|
17
|
+
when 0 then servo.center
|
18
|
+
when 180 then servo.min
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'artoo'
|
2
|
+
|
3
|
+
connection :arduino, :adaptor => :firmata, :port => "127.0.0.1:8023"
|
4
|
+
device :wiichuck, :driver => :wiichuck, :connection => :arduino, :interval => 0.1
|
5
|
+
|
6
|
+
work do
|
7
|
+
on wiichuck, :c_button => proc { puts "c button pressed!" }
|
8
|
+
on wiichuck, :z_button => proc { puts "z button pressed!" }
|
9
|
+
on wiichuck, :joystick => proc { |*value|
|
10
|
+
puts "joystick x: #{value[1][:x]}, y: #{value[1][:y]}"
|
11
|
+
}
|
12
|
+
end
|
13
|
+
|
@@ -10,7 +10,8 @@ module Artoo
|
|
10
10
|
# Creates connection with firmata board
|
11
11
|
# @return [Boolean]
|
12
12
|
def connect
|
13
|
-
require 'firmata' unless defined?(::Firmata)
|
13
|
+
require 'firmata' unless defined?(::Firmata::Board)
|
14
|
+
|
14
15
|
@firmata = ::Firmata::Board.new(connect_to)
|
15
16
|
@firmata.connect
|
16
17
|
super
|
data/lib/artoo/drivers/button.rb
CHANGED
@@ -17,7 +17,7 @@ module Artoo
|
|
17
17
|
# Sets values to read and write from button
|
18
18
|
# and starts driver
|
19
19
|
def start_driver
|
20
|
-
connection.set_pin_mode(pin, Firmata::
|
20
|
+
connection.set_pin_mode(pin, Firmata::PinModes::INPUT)
|
21
21
|
connection.toggle_pin_reporting(pin)
|
22
22
|
|
23
23
|
every(interval) do
|
@@ -29,14 +29,14 @@ module Artoo
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def handle_events
|
32
|
-
while i = find_event("
|
32
|
+
while i = find_event("digital_read_#{pin}") do
|
33
33
|
event = events.slice!(i)
|
34
34
|
update(event.data.first) if !event.nil?
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
def find_event(name)
|
39
|
-
events.index {|e| e.name == name}
|
39
|
+
events.index {|e| e.name == name.to_sym}
|
40
40
|
end
|
41
41
|
|
42
42
|
def events
|
data/lib/artoo/drivers/led.rb
CHANGED
@@ -5,44 +5,57 @@ module Artoo
|
|
5
5
|
# The LED driver behaviors
|
6
6
|
class Led < Driver
|
7
7
|
|
8
|
-
COMMANDS = [:firmware_name, :version,
|
8
|
+
COMMANDS = [:firmware_name, :version,
|
9
|
+
:on, :off, :toggle,
|
10
|
+
:brightness,
|
11
|
+
:on?, :off?].freeze
|
9
12
|
|
13
|
+
def initialize(params = {})
|
14
|
+
@is_on = false
|
15
|
+
super
|
16
|
+
end
|
10
17
|
# @return [Boolean] True if on
|
11
|
-
def
|
12
|
-
|
18
|
+
def on?
|
19
|
+
@is_on
|
13
20
|
end
|
14
21
|
|
15
22
|
# @return [Boolean] True if off
|
16
|
-
def
|
17
|
-
(
|
23
|
+
def off?
|
24
|
+
(not on?)
|
18
25
|
end
|
19
26
|
|
20
|
-
# Sets led to
|
27
|
+
# Sets led to level HIGH
|
21
28
|
def on
|
29
|
+
change_state(pin, Firmata::PinLevels::HIGH)
|
22
30
|
@is_on = true
|
23
|
-
|
24
|
-
connection.digital_write(pin, Firmata::Board::HIGH)
|
31
|
+
true
|
25
32
|
end
|
26
33
|
|
27
|
-
# Sets led to
|
34
|
+
# Sets led to level LOW
|
28
35
|
def off
|
36
|
+
change_state(pin, Firmata::PinLevels::LOW)
|
29
37
|
@is_on = false
|
30
|
-
|
31
|
-
connection.digital_write(pin, Firmata::Board::LOW)
|
38
|
+
true
|
32
39
|
end
|
33
40
|
|
34
41
|
# Toggle status
|
35
42
|
# @example on > off, off > on
|
36
43
|
def toggle
|
37
|
-
|
44
|
+
on? ? off : on
|
38
45
|
end
|
39
46
|
|
40
47
|
# Change brightness level
|
41
48
|
# @param [Integer] level
|
42
49
|
def brightness(level=0)
|
43
|
-
connection.set_pin_mode(pin, Firmata::
|
50
|
+
connection.set_pin_mode(pin, Firmata::PinModes::PWM)
|
44
51
|
connection.analog_write(pin, level)
|
45
52
|
end
|
53
|
+
|
54
|
+
private
|
55
|
+
def change_state(pin, level)
|
56
|
+
connection.set_pin_mode(pin, Firmata::PinModes::OUTPUT)
|
57
|
+
connection.digital_write(pin, level)
|
58
|
+
end
|
46
59
|
end
|
47
60
|
end
|
48
61
|
end
|
data/lib/artoo/drivers/motor.rb
CHANGED
@@ -31,14 +31,14 @@ module Artoo
|
|
31
31
|
# Sets movement forward
|
32
32
|
# @param [Integer] s speed
|
33
33
|
def forward(s)
|
34
|
-
set_legs(Firmata::
|
34
|
+
set_legs(Firmata::PinLevels::LOW, Firmata::PinLevels::HIGH)
|
35
35
|
speed(s)
|
36
36
|
end
|
37
37
|
|
38
38
|
# Sets movement backward
|
39
39
|
# @param [Integer] s speed
|
40
40
|
def backward(s)
|
41
|
-
set_legs(Firmata::
|
41
|
+
set_legs(Firmata::PinLevels::HIGH, Firmata::PinLevels::LOW)
|
42
42
|
speed(s)
|
43
43
|
end
|
44
44
|
|
@@ -52,16 +52,16 @@ module Artoo
|
|
52
52
|
def speed(s)
|
53
53
|
raise "Motor speed must be an integer between 0-255" unless (s.is_a?(Numeric) && s >= 0 && s <= 255)
|
54
54
|
@current_speed = s
|
55
|
-
connection.set_pin_mode(speed_pin, Firmata::
|
55
|
+
connection.set_pin_mode(speed_pin, Firmata::PinModes::PWM)
|
56
56
|
connection.analog_write(speed_pin, s)
|
57
57
|
end
|
58
58
|
|
59
59
|
private
|
60
60
|
|
61
61
|
def set_legs(l1, l2)
|
62
|
-
connection.set_pin_mode(leg1_pin, Firmata::
|
62
|
+
connection.set_pin_mode(leg1_pin, Firmata::PinModes::OUTPUT)
|
63
63
|
connection.digital_write(leg1_pin, l1)
|
64
|
-
connection.set_pin_mode(leg2_pin, Firmata::
|
64
|
+
connection.set_pin_mode(leg2_pin, Firmata::PinModes::OUTPUT)
|
65
65
|
connection.digital_write(leg2_pin, l2)
|
66
66
|
end
|
67
67
|
end
|
data/lib/artoo/drivers/servo.rb
CHANGED
@@ -4,7 +4,7 @@ module Artoo
|
|
4
4
|
module Drivers
|
5
5
|
# Servo behaviors for Firmata
|
6
6
|
class Servo < Driver
|
7
|
-
COMMANDS = [:move, :min, :center, :max].freeze
|
7
|
+
COMMANDS = [:move, :min, :center, :max, :current_angle].freeze
|
8
8
|
|
9
9
|
attr_reader :current_angle
|
10
10
|
|
@@ -30,7 +30,7 @@ module Artoo
|
|
30
30
|
raise "Servo angle must be an integer between 0-180" unless (angle.is_a?(Numeric) && angle >= 0 && angle <= 180)
|
31
31
|
|
32
32
|
@current_angle = angle
|
33
|
-
connection.set_pin_mode(pin, Firmata::
|
33
|
+
connection.set_pin_mode(pin, Firmata::PinModes::SERVO)
|
34
34
|
connection.analog_write(pin, angle_to_span(angle))
|
35
35
|
end
|
36
36
|
|
data/test/drivers/led_test.rb
CHANGED
@@ -11,46 +11,90 @@ describe Artoo::Drivers::Led do
|
|
11
11
|
@device.stubs(:connection).returns(@connection)
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
@led.is_on?.must_equal false
|
16
|
-
end
|
14
|
+
describe 'state switching' do
|
17
15
|
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
before do
|
17
|
+
@connection.expects(:set_pin_mode).with(@pin, Firmata::PinModes::OUTPUT)
|
18
|
+
end
|
21
19
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
describe '#on' do
|
21
|
+
it 'must turn the led on' do
|
22
|
+
@connection.expects(:digital_write).with(@pin, Firmata::PinLevels::HIGH)
|
23
|
+
@led.on
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '#off' do
|
28
|
+
it 'must turn the led off' do
|
29
|
+
@connection.expects(:digital_write).with(@pin, Firmata::PinLevels::LOW)
|
30
|
+
@led.off
|
31
|
+
end
|
32
|
+
end
|
27
33
|
end
|
28
34
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
35
|
+
describe 'state checking' do
|
36
|
+
|
37
|
+
before do
|
38
|
+
@led.stubs(:change_state)
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#on?' do
|
42
|
+
it 'must return true if led is on' do
|
43
|
+
@led.on
|
44
|
+
@led.on?.must_equal true
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'must return false if led is off' do
|
48
|
+
@led.off
|
49
|
+
@led.on?.must_equal false
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe '#off?' do
|
54
|
+
it 'must return true if led is off' do
|
55
|
+
@led.off
|
56
|
+
@led.off?.must_equal true
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'must return false if led is on' do
|
60
|
+
@led.on
|
61
|
+
@led.off?.must_equal false
|
62
|
+
end
|
63
|
+
end
|
34
64
|
end
|
35
65
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
66
|
+
describe '#toggle' do
|
67
|
+
it 'must toggle the state of the led' do
|
68
|
+
@led.stubs(:pin_state_on_board).returns(false)
|
69
|
+
@connection.stubs(:set_pin_mode)
|
70
|
+
@connection.stubs(:digital_write)
|
71
|
+
@led.off?.must_equal true
|
72
|
+
@led.toggle
|
73
|
+
@led.on?.must_equal true
|
74
|
+
@led.toggle
|
75
|
+
@led.off?.must_equal true
|
76
|
+
end
|
44
77
|
end
|
45
78
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
79
|
+
describe '#brightness' do
|
80
|
+
it 'must change the brightness of the led' do
|
81
|
+
val = 100
|
82
|
+
@connection.expects(:set_pin_mode).with(@pin, Firmata::PinModes::PWM)
|
83
|
+
@connection.expects(:analog_write).with(@pin, val)
|
84
|
+
@led.brightness(val)
|
85
|
+
end
|
51
86
|
end
|
52
87
|
|
53
|
-
|
54
|
-
|
88
|
+
describe '#commands' do
|
89
|
+
it 'must contain all the necessary commands' do
|
90
|
+
@led.commands.must_include :firmware_name
|
91
|
+
@led.commands.must_include :version
|
92
|
+
@led.commands.must_include :on
|
93
|
+
@led.commands.must_include :off
|
94
|
+
@led.commands.must_include :toggle
|
95
|
+
@led.commands.must_include :brightness
|
96
|
+
@led.commands.must_include :on?
|
97
|
+
@led.commands.must_include :off?
|
98
|
+
end
|
55
99
|
end
|
56
100
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: artoo-arduino
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ron Evans
|
8
8
|
- Adrian Zankich
|
9
|
+
- Rafael Magaña
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
13
|
+
date: 2013-08-21 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: artoo
|
@@ -17,28 +18,28 @@ dependencies:
|
|
17
18
|
requirements:
|
18
19
|
- - ~>
|
19
20
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.0.0
|
21
|
+
version: 1.0.0
|
21
22
|
type: :runtime
|
22
23
|
prerelease: false
|
23
24
|
version_requirements: !ruby/object:Gem::Requirement
|
24
25
|
requirements:
|
25
26
|
- - ~>
|
26
27
|
- !ruby/object:Gem::Version
|
27
|
-
version: 1.0.0
|
28
|
+
version: 1.0.0
|
28
29
|
- !ruby/object:Gem::Dependency
|
29
30
|
name: hybridgroup-firmata
|
30
31
|
requirement: !ruby/object:Gem::Requirement
|
31
32
|
requirements:
|
32
33
|
- - ~>
|
33
34
|
- !ruby/object:Gem::Version
|
34
|
-
version: 0.4.
|
35
|
+
version: 0.4.3
|
35
36
|
type: :runtime
|
36
37
|
prerelease: false
|
37
38
|
version_requirements: !ruby/object:Gem::Requirement
|
38
39
|
requirements:
|
39
40
|
- - ~>
|
40
41
|
- !ruby/object:Gem::Version
|
41
|
-
version: 0.4.
|
42
|
+
version: 0.4.3
|
42
43
|
- !ruby/object:Gem::Dependency
|
43
44
|
name: minitest
|
44
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -97,8 +98,13 @@ files:
|
|
97
98
|
- README.md
|
98
99
|
- Rakefile
|
99
100
|
- artoo-arduino.gemspec
|
100
|
-
- examples/
|
101
|
-
- examples/
|
101
|
+
- examples/firmata_blink_led.rb
|
102
|
+
- examples/firmata_blink_led_with_toggle.rb
|
103
|
+
- examples/firmata_button_and_led.rb
|
104
|
+
- examples/firmata_led_brightness.rb
|
105
|
+
- examples/firmata_motor.rb
|
106
|
+
- examples/firmata_servo.rb
|
107
|
+
- examples/firmata_wiichuck.rb
|
102
108
|
- lib/artoo-arduino.rb
|
103
109
|
- lib/artoo-arduino/version.rb
|
104
110
|
- lib/artoo/adaptors/firmata.rb
|
data/examples/button_and_led.rb
DELETED
data/examples/firmata.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'artoo'
|
2
|
-
|
3
|
-
connection :arduino, :adaptor => :firmata, :port => '127.0.0.1:8023'
|
4
|
-
device :board
|
5
|
-
device :led, :driver => :led, :pin => 13
|
6
|
-
|
7
|
-
work do
|
8
|
-
puts "Firmware name #{board.firmware_name}"
|
9
|
-
puts "Firmata version #{board.version}"
|
10
|
-
every 1.second do
|
11
|
-
led.toggle
|
12
|
-
end
|
13
|
-
end
|