arduino_ir_remote 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 633534d5f2ff931a20109d358904351b0547d689
4
- data.tar.gz: 2a12d471651cfb58222d747a9594e72699199afd
3
+ metadata.gz: 9fdbaf9f2cea41fac97e73b5c7e1e79eb8ddeb41
4
+ data.tar.gz: bf264063ec7ad04aec0eafb85a8e9c1e7db07e47
5
5
  SHA512:
6
- metadata.gz: ec5c1e0ab030de3803d8c63c5d9a1ed89000ef180f0f97cb01679c1f1b283699483d4b15e558a364d3646385bcbb577f2bca8cc7660eda1bfd33da7020dde23a
7
- data.tar.gz: c9ae45cfad5390d34fc6834b002c5e01b87ebd3fb4b7d29ae2541f80ca33c2b9fa341d52e0c66fe95faaccb73f6b01e179f33fc545199bf4a4fa385ee32346f7
6
+ metadata.gz: 84ca6017e737810930347f39e1b6caccb200143f8ed8632c7f3a96573318357a7a33f120aaab55efb7bd8e8ca43cfafa80db96acef466f7f40c25ef95b73d27c
7
+ data.tar.gz: 0f4eedf2a5f58733f5e8bf20da746499be405fa4619c21484652ce4f18eefe2d0b4fd70b53ac906aaf407deb2cbde58a20dc98b23ab4d8a0ad4b0eda6773302c
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.1.0 2013-08-17
2
+
3
+ * bugfix Ir-DATA file path
4
+ * manage Ir-DATA by ArduinoIrRemote::DATA class
5
+
1
6
  === 0.0.3 2013-08-14
2
7
 
3
8
  * set post_install_message in gemspec
data/README.md CHANGED
@@ -10,13 +10,12 @@ This Rubygem provides a wrapper for IR-Learning-Remote that has been built using
10
10
  Installation
11
11
  ------------
12
12
 
13
- % gem install arduino_ir_remote
13
+ ### Install Rubygem
14
14
 
15
+ % gem install arduino_ir_remote
15
16
 
16
- Dependencies
17
- ------------
18
17
 
19
- ### Requirements
18
+ ### Dependencies
20
19
 
21
20
  - Mac or Linux
22
21
  - Ruby 1.8.7 ~ 2.0.0
@@ -25,42 +24,51 @@ Dependencies
25
24
  - IR LED
26
25
  - [Temperature Sensor LM35DZ](http://akizukidenshi.com/catalog/g/gI-00116/)
27
26
 
28
- ### Setup Arduino
27
+
28
+ ### Hardware Setup
29
29
 
30
30
  - Arduino Firmware
31
- - `arduino` directory in this repository
32
- - https://github.com/shokai/arduino_ir_remote/blob/master/arduino/arduino.ino
31
+ - [./arduino/arduino.ino](https://github.com/shokai/arduino_ir_remote/blob/master/arduino/arduino.ino)
33
32
  - IR LED
34
33
  - Digital PIN 12
35
34
  - IR Receiver
36
35
  - Digital PIN 3
37
- - Temperature Sensor
36
+ - Temperature Sensor (optional)
38
37
  - Analog PIN 0
38
+ - Additional Sensors (optional)
39
+ - Analog PIN 1~5
40
+
41
+
42
+ IR Receiver + LED (Minimum setup)
43
+ <a href="http://www.flickr.com/photos/shokai/9508327459/"><img src="http://farm8.staticflickr.com/7416/9508327459_54770a00fe_z.jpg"></a>
39
44
 
40
- <img src="http://farm4.staticflickr.com/3779/9469310547_ef06fe7949.jpg">
41
- <img src="http://farm4.staticflickr.com/3831/9472093512_fee45ca7c3.jpg">
42
45
 
46
+ IR Receiver + LED + Temperature Sensor + CdS
47
+ <a href="http://www.flickr.com/photos/shokai/9511120396/"><img src="http://farm6.staticflickr.com/5543/9511120396_404eef32b7_z.jpg"></a><a href="http://www.flickr.com/photos/shokai/9506165953/"><img src="http://farm3.staticflickr.com/2861/9506165953_14c36e50cc_z.jpg"></a>
48
+
49
+
50
+ Usage
51
+ -----
52
+
53
+ ### arduino_ir_remote command
43
54
 
44
- arduino_ir_remote command
45
- -------------------------
46
55
 
47
56
  % arduino_ir_remote --help
48
57
  % arduino_ir_remote --list
49
58
 
50
- read IR
59
+ Read IR Data
51
60
 
52
61
  % arduino_ir_remote --read tv_on
53
62
 
54
- write IR
63
+ Write IR Data
55
64
 
56
65
  % arduino_ir_remote --write tv_on
57
66
 
58
67
 
59
- Gem Usage
60
- ---------
61
68
 
62
- ### Connect
69
+ ### Rubygem
63
70
 
71
+ Connect
64
72
  ```ruby
65
73
  require 'arduino_ir_remote'
66
74
 
@@ -68,24 +76,23 @@ ir = ArduinoIrRemote.connect # use default device
68
76
  ir = ArduinoIrRemote.connect "/dev/tty.usb-devicename"
69
77
  ```
70
78
 
71
- ### Read IR DATA
72
-
79
+ Read IR DATA
73
80
  ```ruby
74
81
  ir.read do |data|
75
82
  p data
83
+ ArduinoIrRemote::DATA["tv_on"] = data
84
+ ArduinoIrRemote::DATA["tv_on"].save
76
85
  end
77
86
  ir.wait
78
87
  ```
79
88
 
80
- ### Write IR DATA
81
-
89
+ Write IR DATA
82
90
  ```ruby
83
- ir.write data
91
+ ir.write ArduinoIrRemote::DATA["tv_on"]
84
92
  ir.wait
85
93
  ```
86
94
 
87
- ### Read Sensors
88
-
95
+ Read Sensors
89
96
  ```ruby
90
97
  ir.temp_pin = 0 # set temperature sensor pin
91
98
 
@@ -22,7 +22,6 @@ Gem::Specification.new do |spec|
22
22
  spec.add_dependency "serialport"
23
23
  spec.add_dependency "args_parser"
24
24
  spec.add_dependency "event_emitter"
25
- spec.add_dependency "hashie"
26
25
 
27
26
  spec.add_development_dependency "bundler", "~> 1.3"
28
27
  spec.add_development_dependency "rake"
@@ -71,9 +71,7 @@ if args.has_param? :read
71
71
  exit 1 if STDIN.gets.strip.downcase =~ /n/
72
72
  end
73
73
  ArduinoIrRemote::DATA[ args[:read] ] = data
74
- File.open(ArduinoIrRemote::DATA_FILE, "w+") do |f|
75
- f.write ArduinoIrRemote::DATA.to_h.to_yaml
76
- end
74
+ ArduinoIrRemote::DATA.save
77
75
  puts %Q{"#{args[:read]}" saved!}
78
76
  exit 1
79
77
  end
@@ -1,10 +1,9 @@
1
1
  require "serialport"
2
2
  require "event_emitter"
3
- require "hashie"
4
- require "yaml"
5
3
 
6
4
  require "arduino_ir_remote/version"
7
5
  require "arduino_ir_remote/config"
6
+ require "arduino_ir_remote/data"
8
7
  require "arduino_ir_remote/ir_remote"
9
8
  require "arduino_ir_remote/main"
10
9
 
@@ -1,7 +1,4 @@
1
1
  module ArduinoIrRemote
2
- DATA_FILE = File.expand_path '.ir_remote.yml', ENV['HOME']
3
- DATA = Hashie::Mash.new YAML::load File.open(DATA_FILE).read
4
-
5
2
  class Status
6
3
  CLOSE = 0
7
4
  OPEN = 1
@@ -0,0 +1,14 @@
1
+ require "yaml"
2
+
3
+ module ArduinoIrRemote
4
+
5
+ DATA_FILE = ENV["IR_DATA_FILE"] || File.expand_path('.ir_remote.yml', ENV['HOME'])
6
+ DATA = File.exists?(DATA_FILE) ? YAML.load_file(DATA_FILE) : {}
7
+
8
+ def DATA.save
9
+ File.open DATA_FILE, "w+" do |f|
10
+ f.write self.to_yaml
11
+ end
12
+ end
13
+
14
+ end
@@ -1,3 +1,3 @@
1
1
  module ArduinoIrRemote
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arduino_ir_remote
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sho Hashimoto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-13 00:00:00.000000000 Z
11
+ date: 2013-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: serialport
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: hashie
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '>='
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: bundler
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -129,6 +115,7 @@ files:
129
115
  - bin/arduino_ir_remote
130
116
  - lib/arduino_ir_remote.rb
131
117
  - lib/arduino_ir_remote/config.rb
118
+ - lib/arduino_ir_remote/data.rb
132
119
  - lib/arduino_ir_remote/ir_remote.rb
133
120
  - lib/arduino_ir_remote/main.rb
134
121
  - lib/arduino_ir_remote/version.rb