artoo-arduino 1.4.3 → 1.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +6 -6
- data/README.md +0 -6
- data/artoo-arduino.gemspec +4 -4
- data/examples/analog_sensor.rb +0 -1
- data/examples/led_dance.rb +31 -0
- data/examples/temperature_sensor.rb +15 -0
- data/lib/artoo-arduino.rb +3 -4
- data/lib/artoo-arduino/version.rb +1 -1
- data/lib/artoo/adaptors/firmata.rb +2 -7
- data/test/adaptors/firmata_test.rb +1 -0
- data/test/test_helper.rb +2 -0
- metadata +33 -35
- data/Gemfile.lock +0 -70
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37f2c8debd9d14ba4a38e1f9a774a320efc7cf9e
|
4
|
+
data.tar.gz: 1de8cea99160cdc864644fa7ec47cc38a820eab8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e90ecfbc36317303699a0db9239b80dd6c1cc31d338049fa7b04e79a7da0e0bc70fbd63ebf184fa41ecfc107e3615afddf973d498f517d8e875142ff604993ef
|
7
|
+
data.tar.gz: de66fc030176df9fc8954751e04458430badf6d4ad2362b4c206e307875b0d32ce91c51723292efbf6ee7d1bfabb0949aaab6aaaacc655bcf427140a9afcba19
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -66,12 +66,6 @@ Install the artoo-arduino gem:
|
|
66
66
|
$ gem install artoo-arduino
|
67
67
|
```
|
68
68
|
|
69
|
-
Install the hybridgroup-serialport gem:
|
70
|
-
|
71
|
-
```
|
72
|
-
$ gem install hybridgroup-serialport
|
73
|
-
```
|
74
|
-
|
75
69
|
Once plugged in, use the `artoo connect scan -t serial` command to find out your connection info and serial port address:
|
76
70
|
|
77
71
|
```
|
data/artoo-arduino.gemspec
CHANGED
@@ -22,10 +22,10 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.extensions = ["ext/Rakefile"]
|
23
23
|
|
24
24
|
s.add_runtime_dependency 'artoo', '>= 1.6.0'
|
25
|
-
s.add_runtime_dependency 'artoo-gpio'
|
26
|
-
s.add_runtime_dependency 'artoo-i2c'
|
27
|
-
s.add_runtime_dependency 'hybridgroup-firmata', '>= 0.4.
|
25
|
+
s.add_runtime_dependency 'artoo-gpio', '>= 0.4.1'
|
26
|
+
s.add_runtime_dependency 'artoo-i2c', '>= 0.5.0'
|
27
|
+
s.add_runtime_dependency 'hybridgroup-firmata', '>= 0.4.6'
|
28
28
|
s.add_development_dependency 'minitest', '~> 5.0'
|
29
|
-
s.add_development_dependency 'minitest-happy'
|
29
|
+
s.add_development_dependency 'minitest-happy', '~> 1.0.0'
|
30
30
|
s.add_development_dependency 'mocha', '~> 0.14.0'
|
31
31
|
end
|
data/examples/analog_sensor.rb
CHANGED
@@ -7,7 +7,6 @@ require 'artoo'
|
|
7
7
|
connection :firmata, :adaptor => :firmata, :port => '/dev/ttyACM0' #linux
|
8
8
|
#connection :firmata, :adaptor => :firmata, :port => '127.0.0.1:8023'
|
9
9
|
|
10
|
-
# Analog inputs are based from 0 to 5 on the Arduino UNO, may vary on other arduino boards
|
11
10
|
device :sensor, driver: :analog_sensor, pin: 0, interval: 0.25, upper: 900, lower: 200
|
12
11
|
device :led, :driver => :led, :pin => 8
|
13
12
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Use this example to make your leds dance!
|
2
|
+
# LEDS variable controls number of connected leds
|
3
|
+
# TIME varirable controls velocity
|
4
|
+
# First led should be on port 2, next leds on consecutive ports
|
5
|
+
|
6
|
+
require 'artoo'
|
7
|
+
|
8
|
+
LEDS = 6
|
9
|
+
TIME = 0.05
|
10
|
+
|
11
|
+
connection :firmata, :adaptor => :firmata, :port => '/dev/tty.usbmodem1411' #osx
|
12
|
+
device :board, :driver => :device_info
|
13
|
+
|
14
|
+
LEDS.times do |i|
|
15
|
+
device "led_#{i+1}", :driver => :led, :pin => (i+2)
|
16
|
+
end
|
17
|
+
|
18
|
+
work do
|
19
|
+
|
20
|
+
current = 0
|
21
|
+
leds = devices.to_a.select {|d| d[1].name.include?('led') }
|
22
|
+
|
23
|
+
every(TIME) do
|
24
|
+
led = leds[current % LEDS][1]
|
25
|
+
|
26
|
+
led.on? ? led.off : led.on
|
27
|
+
|
28
|
+
current += 1
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'artoo'
|
2
|
+
|
3
|
+
connection :firmata, :adaptor => :firmata, :port => '/dev/cu.usbmodem1451'
|
4
|
+
|
5
|
+
# TMP36 temperature sensor used for this example
|
6
|
+
device :sensor, driver: :analog_sensor, pin: 0
|
7
|
+
|
8
|
+
work do
|
9
|
+
every 5 do
|
10
|
+
voltage = ( sensor.analog_read(0) * 5.0 ) / 1024
|
11
|
+
temp = ( voltage - 0.5 ) * 100
|
12
|
+
|
13
|
+
puts "Current temperature is #{temp}"
|
14
|
+
end
|
15
|
+
end
|
data/lib/artoo-arduino.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
require '
|
2
|
-
require 'lib/artoo/adaptors/littlewire'
|
1
|
+
require 'artoo/adaptors/firmata'
|
3
2
|
|
4
3
|
%w{ button led motor servo wiichuck wiiclassic wiidriver }.each do |f|
|
5
|
-
require "
|
4
|
+
require "artoo/drivers/#{f}"
|
6
5
|
end
|
7
6
|
|
8
|
-
require '
|
7
|
+
require 'artoo-arduino/version'
|
@@ -53,10 +53,9 @@ module Artoo
|
|
53
53
|
end
|
54
54
|
|
55
55
|
# GPIO - analog
|
56
|
-
# NOTE pins are numbered A0-A5, which translate to digital pins 14-19
|
57
56
|
def analog_read(pin)
|
58
|
-
firmata.set_pin_mode(
|
59
|
-
firmata.toggle_pin_reporting(
|
57
|
+
firmata.set_pin_mode(firmata.analog_pins[pin], ::Firmata::PinModes::ANALOG)
|
58
|
+
firmata.toggle_pin_reporting(firmata.analog_pins[pin])
|
60
59
|
firmata.read_and_process
|
61
60
|
|
62
61
|
value = 0
|
@@ -67,10 +66,6 @@ module Artoo
|
|
67
66
|
value
|
68
67
|
end
|
69
68
|
|
70
|
-
def digital_pin(pin = 0)
|
71
|
-
pin + 14
|
72
|
-
end
|
73
|
-
|
74
69
|
# GPIO - PWM
|
75
70
|
def pwm_write(pin, level)
|
76
71
|
firmata.set_pin_mode(pin, ::Firmata::PinModes::PWM)
|
@@ -66,6 +66,7 @@ describe Artoo::Adaptors::Firmata do
|
|
66
66
|
it "#analog_read" do
|
67
67
|
@firmata_event.stubs(:name).returns(:analog_read_1)
|
68
68
|
@firmata_event.stubs(:data).returns([128])
|
69
|
+
@firmata.stubs(:analog_pins).returns([0,1])
|
69
70
|
@firmata.expects(:read_and_process)
|
70
71
|
@adaptor.analog_read(1).must_equal 128
|
71
72
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: artoo-arduino
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ron Evans
|
@@ -11,104 +11,104 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2014-
|
14
|
+
date: 2014-07-04 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: artoo
|
18
18
|
requirement: !ruby/object:Gem::Requirement
|
19
19
|
requirements:
|
20
|
-
- -
|
20
|
+
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 1.6.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 1.6.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: artoo-gpio
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
requirements:
|
34
|
-
- -
|
34
|
+
- - ">="
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version:
|
36
|
+
version: 0.4.1
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
|
-
- -
|
41
|
+
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
43
|
+
version: 0.4.1
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
45
|
name: artoo-i2c
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
|
-
- -
|
48
|
+
- - ">="
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version:
|
50
|
+
version: 0.5.0
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
|
-
- -
|
55
|
+
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version:
|
57
|
+
version: 0.5.0
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: hybridgroup-firmata
|
60
60
|
requirement: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
|
-
- -
|
62
|
+
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version: 0.4.
|
64
|
+
version: 0.4.6
|
65
65
|
type: :runtime
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
|
-
- -
|
69
|
+
- - ">="
|
70
70
|
- !ruby/object:Gem::Version
|
71
|
-
version: 0.4.
|
71
|
+
version: 0.4.6
|
72
72
|
- !ruby/object:Gem::Dependency
|
73
73
|
name: minitest
|
74
74
|
requirement: !ruby/object:Gem::Requirement
|
75
75
|
requirements:
|
76
|
-
- - ~>
|
76
|
+
- - "~>"
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: '5.0'
|
79
79
|
type: :development
|
80
80
|
prerelease: false
|
81
81
|
version_requirements: !ruby/object:Gem::Requirement
|
82
82
|
requirements:
|
83
|
-
- - ~>
|
83
|
+
- - "~>"
|
84
84
|
- !ruby/object:Gem::Version
|
85
85
|
version: '5.0'
|
86
86
|
- !ruby/object:Gem::Dependency
|
87
87
|
name: minitest-happy
|
88
88
|
requirement: !ruby/object:Gem::Requirement
|
89
89
|
requirements:
|
90
|
-
- -
|
90
|
+
- - "~>"
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version:
|
92
|
+
version: 1.0.0
|
93
93
|
type: :development
|
94
94
|
prerelease: false
|
95
95
|
version_requirements: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
|
-
- -
|
97
|
+
- - "~>"
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version:
|
99
|
+
version: 1.0.0
|
100
100
|
- !ruby/object:Gem::Dependency
|
101
101
|
name: mocha
|
102
102
|
requirement: !ruby/object:Gem::Requirement
|
103
103
|
requirements:
|
104
|
-
- - ~>
|
104
|
+
- - "~>"
|
105
105
|
- !ruby/object:Gem::Version
|
106
106
|
version: 0.14.0
|
107
107
|
type: :development
|
108
108
|
prerelease: false
|
109
109
|
version_requirements: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
|
-
- - ~>
|
111
|
+
- - "~>"
|
112
112
|
- !ruby/object:Gem::Version
|
113
113
|
version: 0.14.0
|
114
114
|
description: Artoo adaptor and driver for Arduino
|
@@ -119,11 +119,10 @@ extensions:
|
|
119
119
|
- ext/Rakefile
|
120
120
|
extra_rdoc_files: []
|
121
121
|
files:
|
122
|
-
- .gitignore
|
123
|
-
- .rvmrc.example
|
124
|
-
- .travis.yml
|
122
|
+
- ".gitignore"
|
123
|
+
- ".rvmrc.example"
|
124
|
+
- ".travis.yml"
|
125
125
|
- Gemfile
|
126
|
-
- Gemfile.lock
|
127
126
|
- LICENSE
|
128
127
|
- README.md
|
129
128
|
- Rakefile
|
@@ -138,11 +137,13 @@ files:
|
|
138
137
|
- examples/dc_motor_switch_h-bridge_2_pins.rb
|
139
138
|
- examples/led_brightness.rb
|
140
139
|
- examples/led_brightness_with_analog_input.rb
|
140
|
+
- examples/led_dance.rb
|
141
141
|
- examples/led_with_button_toggle.rb
|
142
142
|
- examples/maxbotix.rb
|
143
143
|
- examples/motor.rb
|
144
144
|
- examples/motor_speed_with_analog_input.rb
|
145
145
|
- examples/servo.rb
|
146
|
+
- examples/temperature_sensor.rb
|
146
147
|
- examples/wiichuck.rb
|
147
148
|
- ext/Rakefile
|
148
149
|
- lib/artoo-arduino.rb
|
@@ -163,21 +164,18 @@ require_paths:
|
|
163
164
|
- lib
|
164
165
|
required_ruby_version: !ruby/object:Gem::Requirement
|
165
166
|
requirements:
|
166
|
-
- -
|
167
|
+
- - ">="
|
167
168
|
- !ruby/object:Gem::Version
|
168
169
|
version: '0'
|
169
170
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
171
|
requirements:
|
171
|
-
- -
|
172
|
+
- - ">="
|
172
173
|
- !ruby/object:Gem::Version
|
173
174
|
version: '0'
|
174
175
|
requirements: []
|
175
176
|
rubyforge_project: artoo-arduino
|
176
|
-
rubygems_version: 2.
|
177
|
+
rubygems_version: 2.2.2
|
177
178
|
signing_key:
|
178
179
|
specification_version: 4
|
179
180
|
summary: Artoo adaptor and driver for Arduino
|
180
|
-
test_files:
|
181
|
-
- test/adaptors/firmata_test.rb
|
182
|
-
- test/test_helper.rb
|
183
|
-
has_rdoc:
|
181
|
+
test_files: []
|
data/Gemfile.lock
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
artoo-arduino (1.4.2)
|
5
|
-
artoo (>= 1.6.0)
|
6
|
-
artoo-gpio
|
7
|
-
artoo-i2c
|
8
|
-
hybridgroup-firmata (>= 0.4.5)
|
9
|
-
|
10
|
-
GEM
|
11
|
-
remote: http://rubygems.org/
|
12
|
-
specs:
|
13
|
-
artoo (1.6.1)
|
14
|
-
celluloid (~> 0.15.0)
|
15
|
-
celluloid-io (~> 0.15.0)
|
16
|
-
multi_json (~> 1.6)
|
17
|
-
pry (~> 0.9)
|
18
|
-
rake
|
19
|
-
reel (~> 0.4.0)
|
20
|
-
robeaux (~> 0.0.3)
|
21
|
-
thor (~> 0.18.1)
|
22
|
-
artoo-gpio (0.4.0)
|
23
|
-
artoo (>= 1.6.0)
|
24
|
-
artoo-i2c (0.5.0)
|
25
|
-
artoo (>= 1.6.0)
|
26
|
-
celluloid (0.15.2)
|
27
|
-
timers (~> 1.1.0)
|
28
|
-
celluloid-io (0.15.0)
|
29
|
-
celluloid (>= 0.15.0)
|
30
|
-
nio4r (>= 0.5.0)
|
31
|
-
coderay (1.1.0)
|
32
|
-
event_emitter (0.2.5)
|
33
|
-
http (0.5.0)
|
34
|
-
http_parser.rb
|
35
|
-
http_parser.rb (0.6.0)
|
36
|
-
hybridgroup-firmata (0.4.5)
|
37
|
-
event_emitter
|
38
|
-
metaclass (0.0.1)
|
39
|
-
method_source (0.8.2)
|
40
|
-
minitest (5.0.1)
|
41
|
-
minitest-happy (1.0.0)
|
42
|
-
mocha (0.14.0)
|
43
|
-
metaclass (~> 0.0.1)
|
44
|
-
multi_json (1.8.4)
|
45
|
-
nio4r (1.0.0)
|
46
|
-
pry (0.9.12.6)
|
47
|
-
coderay (~> 1.0)
|
48
|
-
method_source (~> 0.8)
|
49
|
-
slop (~> 3.4)
|
50
|
-
rake (10.1.1)
|
51
|
-
reel (0.4.0)
|
52
|
-
celluloid (>= 0.15.1)
|
53
|
-
celluloid-io (>= 0.15.0)
|
54
|
-
http (>= 0.5.0)
|
55
|
-
http_parser.rb (>= 0.6.0.beta.2)
|
56
|
-
websocket_parser (>= 0.1.4)
|
57
|
-
robeaux (0.0.4)
|
58
|
-
slop (3.4.7)
|
59
|
-
thor (0.18.1)
|
60
|
-
timers (1.1.0)
|
61
|
-
websocket_parser (0.1.6)
|
62
|
-
|
63
|
-
PLATFORMS
|
64
|
-
ruby
|
65
|
-
|
66
|
-
DEPENDENCIES
|
67
|
-
artoo-arduino!
|
68
|
-
minitest (~> 5.0)
|
69
|
-
minitest-happy
|
70
|
-
mocha (~> 0.14.0)
|