arduino_ir_remote 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/History.txt +5 -0
- data/README.md +9 -0
- data/Rakefile +7 -0
- data/arduino_ir_remote.gemspec +3 -2
- data/bin/arduino_ir_remote +1 -1
- data/lib/arduino_ir_remote/config.rb +5 -0
- data/lib/arduino_ir_remote/ir_remote.rb +14 -5
- data/lib/arduino_ir_remote/version.rb +1 -1
- data/test/test_helper.rb +5 -0
- data/test/test_ir_remote.rb +24 -0
- metadata +22 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca3617b6ff8956adaff02f74247d92e5b9a869af
|
4
|
+
data.tar.gz: 2c6d4b9489c09047782816d81a277ec852b0f96c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d188ae4d99dd2dd8ab0b306030328b52835780af3c81437203426ee35f4089f41f3e4bdf0b93688d9b3f1795f75b01062ac7dfa90224152934e4ef3cbab5267
|
7
|
+
data.tar.gz: 1be1417a3ce41959017e0662143b3f8c61817f2fccc1a35223a2c51378998f7a28d388ab6efb682a2281a69be741bb9237409a0d3e83600bd0515f93408c8509
|
data/History.txt
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
data/arduino_ir_remote.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = ArduinoIrRemote::VERSION
|
9
9
|
spec.authors = ["Sho Hashimoto"]
|
10
10
|
spec.email = ["hashimoto@shokai.org"]
|
11
|
-
spec.description = %q{IR
|
12
|
-
spec.summary =
|
11
|
+
spec.description = %q{This Rubygem provides a wrapper for IR-Learning-Remote that has been built using the Arduino. https://github.com/shokai/arduino_ir_remote}
|
12
|
+
spec.summary = spec.description
|
13
13
|
spec.homepage = "https://github.com/shokai/arduino_ir_remote"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
@@ -25,4 +25,5 @@ Gem::Specification.new do |spec|
|
|
25
25
|
|
26
26
|
spec.add_development_dependency "bundler", "~> 1.3"
|
27
27
|
spec.add_development_dependency "rake"
|
28
|
+
spec.add_development_dependency "minitest"
|
28
29
|
end
|
data/bin/arduino_ir_remote
CHANGED
@@ -2,13 +2,16 @@ module ArduinoIrRemote
|
|
2
2
|
class Device
|
3
3
|
include EventEmitter
|
4
4
|
attr_accessor :temp_pin
|
5
|
+
attr_reader :status
|
5
6
|
|
6
7
|
def initialize(port)
|
8
|
+
@status = Status::CLOSE
|
7
9
|
@state = nil
|
8
|
-
@
|
10
|
+
@serial = SerialPort.new(port, 57600, 8, 1, SerialPort::NONE) # 57600bps, 8bit, stopbit1, parity-none
|
11
|
+
@status = Status::OPEN
|
9
12
|
Thread.new do
|
10
|
-
|
11
|
-
process_input @
|
13
|
+
while status == Status::OPEN do
|
14
|
+
process_input @serial.gets.strip
|
12
15
|
end
|
13
16
|
end
|
14
17
|
@temp_pin = 0
|
@@ -16,17 +19,23 @@ module ArduinoIrRemote
|
|
16
19
|
sleep 3
|
17
20
|
end
|
18
21
|
|
22
|
+
def close
|
23
|
+
return if status == Status::CLOSE
|
24
|
+
@status = Status::CLOSE
|
25
|
+
@serial.close
|
26
|
+
end
|
27
|
+
|
19
28
|
public
|
20
29
|
def write(data)
|
21
30
|
"w#{data}W".split(//).each do |c|
|
22
|
-
@
|
31
|
+
@serial.write c
|
23
32
|
sleep 0.001
|
24
33
|
end
|
25
34
|
end
|
26
35
|
|
27
36
|
def read(&block)
|
28
37
|
once :__ir_read, &block if block_given?
|
29
|
-
@
|
38
|
+
@serial.write "r"
|
30
39
|
end
|
31
40
|
|
32
41
|
def analog_read(pin)
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.expand_path 'test_helper', File.dirname(__FILE__)
|
2
|
+
|
3
|
+
class TestIrRemote < MiniTest::Test
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@ir = ArduinoIrRemote.connect ENV["ARDUINO"]
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@ir.close
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_analog_read
|
14
|
+
0.upto(5) do |pin|
|
15
|
+
ain = @ir.analog_read pin
|
16
|
+
assert 0 <= ain and ain < 1024
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_temp_sensor
|
21
|
+
assert_instance_of Float, @ir.temp_sensor
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arduino_ir_remote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sho Hashimoto
|
@@ -94,7 +94,22 @@ dependencies:
|
|
94
94
|
- - '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: minitest
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: This Rubygem provides a wrapper for IR-Learning-Remote that has been
|
112
|
+
built using the Arduino. https://github.com/shokai/arduino_ir_remote
|
98
113
|
email:
|
99
114
|
- hashimoto@shokai.org
|
100
115
|
executables:
|
@@ -117,6 +132,8 @@ files:
|
|
117
132
|
- lib/arduino_ir_remote/main.rb
|
118
133
|
- lib/arduino_ir_remote/version.rb
|
119
134
|
- samples/read_sensor.rb
|
135
|
+
- test/test_helper.rb
|
136
|
+
- test/test_ir_remote.rb
|
120
137
|
homepage: https://github.com/shokai/arduino_ir_remote
|
121
138
|
licenses:
|
122
139
|
- MIT
|
@@ -142,4 +159,6 @@ signing_key:
|
|
142
159
|
specification_version: 4
|
143
160
|
summary: This Rubygem provides a wrapper for IR-Learning-Remote that has been built
|
144
161
|
using the Arduino. https://github.com/shokai/arduino_ir_remote
|
145
|
-
test_files:
|
162
|
+
test_files:
|
163
|
+
- test/test_helper.rb
|
164
|
+
- test/test_ir_remote.rb
|