arduino_firmata 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.2.5 2013-03-13
2
+
3
+ * add sysex command test
4
+ * disable non-blocking IO
5
+
1
6
  === 0.2.4 2013-03-08
2
7
 
3
8
  * use StringIO#each_byte for Ruby2.0.0
data/README.md CHANGED
@@ -143,6 +143,13 @@ end
143
143
  Test
144
144
  ----
145
145
 
146
+ ### Install SysexLedBlinkFirmata into Arduino
147
+
148
+ * https://github.com/shokai/arduino_firmata/blob/master/samples/sysex/StandardFirmataWithLedBlink/StandardFirmataWithLedBlink.ino
149
+
150
+
151
+ ### Run Test
152
+
146
153
  % gem install bundler
147
154
  % bundle install
148
155
  % export ARDUINO=/dev/tty.usb-device-name
data/bin/arduino_firmata CHANGED
@@ -45,3 +45,4 @@ end
45
45
 
46
46
  print arduino.instance_eval parser.argv.join(' ')
47
47
  sleep 1
48
+ arduino.close
@@ -160,12 +160,12 @@ module ArduinoFirmata
160
160
  private
161
161
  def write(cmd)
162
162
  return if status == Status::CLOSE
163
- @serial.write_nonblock cmd.chr
163
+ @serial.write cmd.chr
164
164
  end
165
165
 
166
166
  def read
167
167
  return if status == Status::CLOSE
168
- @serial.read_nonblock 9600 rescue EOFError
168
+ @serial.read 9600 rescue EOFError
169
169
  end
170
170
 
171
171
  def process_input
@@ -1,4 +1,4 @@
1
1
 
2
2
  module ArduinoFirmata
3
- VERSION = '0.2.4'
3
+ VERSION = '0.2.5'
4
4
  end
@@ -6,9 +6,12 @@ class TestArduinoFirmata < MiniTest::Unit::TestCase
6
6
  @arduino = ArduinoFirmata.connect ENV['ARDUINO']
7
7
  end
8
8
 
9
+ def teardown
10
+ @arduino.close
11
+ end
12
+
9
13
  def test_arduino
10
14
  assert @arduino.version > '2.0'
11
- @arduino.close
12
15
  end
13
16
 
14
17
  def test_digital_read
@@ -16,7 +19,6 @@ class TestArduinoFirmata < MiniTest::Unit::TestCase
16
19
  din = @arduino.digital_read pin
17
20
  assert [true,false].include? din
18
21
  end
19
- @arduino.close
20
22
  end
21
23
 
22
24
  def test_analog_read
@@ -24,7 +26,6 @@ class TestArduinoFirmata < MiniTest::Unit::TestCase
24
26
  ain = @arduino.analog_read pin
25
27
  assert 0 <= ain and ain < 1024
26
28
  end
27
- @arduino.close
28
29
  end
29
30
 
30
31
  def test_digital_write
@@ -32,7 +33,6 @@ class TestArduinoFirmata < MiniTest::Unit::TestCase
32
33
  assert @arduino.digital_write(pin, true) == true
33
34
  assert @arduino.digital_write(pin, false) == false
34
35
  end
35
- @arduino.close
36
36
  end
37
37
 
38
38
  def test_analog_write
@@ -40,7 +40,6 @@ class TestArduinoFirmata < MiniTest::Unit::TestCase
40
40
  value = rand(256)
41
41
  assert @arduino.analog_write(pin, value) == value
42
42
  end
43
- @arduino.close
44
43
  end
45
44
 
46
45
  def test_servo_write
@@ -48,7 +47,6 @@ class TestArduinoFirmata < MiniTest::Unit::TestCase
48
47
  angle = rand(181)
49
48
  assert @arduino.servo_write(pin, angle) == angle
50
49
  end
51
- @arduino.close
52
50
  end
53
51
 
54
52
  def test_pin_mode
@@ -56,7 +54,6 @@ class TestArduinoFirmata < MiniTest::Unit::TestCase
56
54
  mode = [ArduinoFirmata::OUTPUT, ArduinoFirmata::INPUT].sample
57
55
  assert @arduino.pin_mode(pin, mode) == mode
58
56
  end
59
- @arduino.close
60
57
  end
61
58
 
62
59
  end
@@ -0,0 +1,34 @@
1
+ ## use samples/sysex/SysexLedBlinkFirmata/SysexLedBlinkFirmata.ino
2
+
3
+ require File.expand_path 'test_helper', File.dirname(__FILE__)
4
+
5
+ class TestSysex < MiniTest::Unit::TestCase
6
+
7
+ def setup
8
+ @arduino = ArduinoFirmata.connect ENV['ARDUINO']
9
+ end
10
+
11
+ def teardown
12
+ @arduino.close
13
+ end
14
+
15
+ def test_sysex_command
16
+ __cmd = nil
17
+ __data = nil
18
+ @arduino.on :sysex do |cmd, data|
19
+ __cmd = cmd
20
+ __data = data
21
+ end
22
+
23
+ @arduino.sysex 0x01, [13, 3, 2]
24
+
25
+ 100.times do
26
+ sleep 0.1
27
+ break if __cmd != nil
28
+ end
29
+
30
+ assert __cmd == 0x01
31
+ assert __data == [13, 0, 3, 0, 2, 0]
32
+ end
33
+
34
+ end
metadata CHANGED
@@ -1,72 +1,60 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: arduino_firmata
3
- version: !ruby/object:Gem::Version
4
- version: 0.2.4
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 0.2.5
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Sho Hashimoto
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-08 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
12
+
13
+ date: 2013-03-13 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
15
16
  name: serialport
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: 1.1.0
22
- type: :runtime
23
17
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
18
+ requirement: &id001 !ruby/object:Gem::Requirement
25
19
  none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
29
23
  version: 1.1.0
30
- - !ruby/object:Gem::Dependency
31
- name: args_parser
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: 0.1.2
38
24
  type: :runtime
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: args_parser
39
28
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
29
+ requirement: &id002 !ruby/object:Gem::Requirement
41
30
  none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
45
34
  version: 0.1.2
46
- - !ruby/object:Gem::Dependency
47
- name: event_emitter
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: 0.2.2
54
35
  type: :runtime
36
+ version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
38
+ name: event_emitter
55
39
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
40
+ requirement: &id003 !ruby/object:Gem::Requirement
57
41
  none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
61
45
  version: 0.2.2
46
+ type: :runtime
47
+ version_requirements: *id003
62
48
  description: Arduino Firmata protocol (http://firmata.org) implementation on Ruby.
63
- email:
49
+ email:
64
50
  - hashimoto@shokai.org
65
- executables:
51
+ executables:
66
52
  - arduino_firmata
67
53
  extensions: []
54
+
68
55
  extra_rdoc_files: []
69
- files:
56
+
57
+ files:
70
58
  - .gitignore
71
59
  - Gemfile
72
60
  - History.txt
@@ -100,32 +88,37 @@ files:
100
88
  - test/test_block.rb
101
89
  - test/test_classmethods.rb
102
90
  - test/test_helper.rb
91
+ - test/test_sysex.rb
103
92
  homepage: http://shokai.github.com/arduino_firmata
104
93
  licenses: []
94
+
105
95
  post_install_message:
106
96
  rdoc_options: []
107
- require_paths:
97
+
98
+ require_paths:
108
99
  - lib
109
- required_ruby_version: !ruby/object:Gem::Requirement
100
+ required_ruby_version: !ruby/object:Gem::Requirement
110
101
  none: false
111
- requirements:
112
- - - ! '>='
113
- - !ruby/object:Gem::Version
114
- version: '0'
115
- required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: "0"
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
107
  none: false
117
- requirements:
118
- - - ! '>='
119
- - !ruby/object:Gem::Version
120
- version: '0'
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: "0"
121
112
  requirements: []
113
+
122
114
  rubyforge_project:
123
- rubygems_version: 1.8.24
115
+ rubygems_version: 1.8.17
124
116
  signing_key:
125
117
  specification_version: 3
126
118
  summary: Arduino Firmata protocol (http://firmata.org) implementation on Ruby.
127
- test_files:
119
+ test_files:
128
120
  - test/test_arduino_firmata.rb
129
121
  - test/test_block.rb
130
122
  - test/test_classmethods.rb
131
123
  - test/test_helper.rb
124
+ - test/test_sysex.rb