hybridgroup-firmata 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8df41a6eb45e2f5a66737b460b071cb1c66cad8c
4
+ data.tar.gz: bf350aefd94fd49b8777aae8a8974c0352dee48e
5
+ SHA512:
6
+ metadata.gz: a7398b7bde99983a239b7346e533dc9c180ab62abafa6f9c380b2145223a8a05033ed29a3e7c59acf3c40f35472d8fe53e16b9c8c1da08e3da6bb45f26438e4f
7
+ data.tar.gz: e8ee53a07f9d14155be744449b11e2d7a8984455fd62ecf93ae4334d84b8ad2403ad0472666c9cb79b4c360dc5a1be539ca1046fa32fe2dd6fb029317fb6b5f4
data/.gitignore CHANGED
@@ -3,7 +3,6 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
- Gemfile.lock
7
6
  InstalledFiles
8
7
  _yardoc
9
8
  coverage
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 1.9.3
5
+ - jruby-19mode
6
+ - rbx-19mode
data/Gemfile.lock ADDED
@@ -0,0 +1,28 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ hybridgroup-firmata (0.4.2)
5
+ event_spitter
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ coderay (1.0.9)
11
+ event_spitter (0.5.0)
12
+ method_source (0.8.2)
13
+ minitest (5.0.6)
14
+ pry (0.9.12.2)
15
+ coderay (~> 1.0.5)
16
+ method_source (~> 0.8)
17
+ slop (~> 3.4)
18
+ rake (10.1.0)
19
+ slop (3.4.6)
20
+
21
+ PLATFORMS
22
+ ruby
23
+
24
+ DEPENDENCIES
25
+ hybridgroup-firmata!
26
+ minitest
27
+ pry
28
+ rake
data/README.md CHANGED
@@ -4,6 +4,8 @@ A Ruby implementation of the [Firmata protocol](http://firmata.org/wiki/V2.2Prot
4
4
 
5
5
  This library is inspired by the awesome [firmata](http://jgautier.github.com/firmata/) by [jgautier](https://github.com/jgautier).
6
6
 
7
+ [![Build Status](https://travis-ci.org/hybridgroup/firmata.png?branch=master)](https://travis-ci.org/hybridgroup/firmata)
8
+
7
9
  ## Installation
8
10
 
9
11
  Add this line to your application's Gemfile:
@@ -1,9 +1,6 @@
1
- require 'bundler/setup'
2
1
  require 'firmata'
3
- require 'socket'
4
2
 
5
- sp = TCPSocket.open 'localhost', 4567
6
- #sp = '/dev/tty.usbserial-A700636n'
3
+ sp = '/dev/ttyACM0'
7
4
  board = Firmata::Board.new(sp)
8
5
 
9
6
  board.connect
@@ -0,0 +1,23 @@
1
+ require 'firmata'
2
+ require 'socket'
3
+
4
+ sp = TCPSocket.open 'localhost', 4567
5
+ board = Firmata::Board.new(sp)
6
+
7
+ board.connect
8
+
9
+ puts "Firmware name #{board.firmware_name}"
10
+ puts "Firmata version #{board.version}"
11
+
12
+ pin_number = 3
13
+ rate = 0.5
14
+
15
+ 10.times do
16
+ board.digital_write pin_number, Firmata::Board::HIGH
17
+ puts '+'
18
+ board.delay rate
19
+
20
+ board.digital_write pin_number, Firmata::Board::LOW
21
+ puts '-'
22
+ board.delay rate
23
+ end
@@ -1,9 +1,6 @@
1
- require 'bundler/setup'
2
1
  require 'firmata'
3
- require 'socket'
4
2
 
5
- sp = TCPSocket.open 'localhost', 4567
6
- #sp = '/dev/tty.usbserial-A700636n'
3
+ sp = '/dev/ttyACM0'
7
4
  board = Firmata::Board.new(sp)
8
5
 
9
6
  board.connect
@@ -0,0 +1,24 @@
1
+ require 'firmata'
2
+ require 'socket'
3
+
4
+ sp = TCPSocket.open 'localhost', 4567
5
+ board = Firmata::Board.new(sp)
6
+
7
+ board.connect
8
+
9
+ puts "Firmware name #{board.firmware_name}"
10
+ puts "Firmata version #{board.version}"
11
+
12
+ pin_number = 2
13
+ rate = 0.5
14
+
15
+ listener = ->(pin, value) { puts("#{pin}:#{value}") }
16
+ board.on('digital-read', listener)
17
+ board.set_pin_mode(pin_number, Firmata::Board::INPUT)
18
+ board.toggle_pin_reporting(pin_number)
19
+
20
+ while true do
21
+ puts "waiting..."
22
+ board.read_and_process
23
+ sleep 0.5
24
+ end
data/firmata.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
  require File.expand_path('../lib/firmata/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
- gem.authors = ["'Mike Breen', 'Adrian Zankich'"]
5
+ gem.authors = ["'Mike Breen', 'Adrian Zankich', 'Ron Evans', 'Isaac A. Murchie'"]
6
6
  gem.email = ["info@hybridgroup.com"]
7
7
  gem.description = %q{A lib for working with the Firmata protocol in Ruby.}
8
8
  gem.summary = %q{}
@@ -15,7 +15,9 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Firmata::VERSION
17
17
 
18
+ gem.add_development_dependency("rake")
18
19
  gem.add_development_dependency("pry")
20
+ gem.add_development_dependency("minitest")
19
21
 
20
22
  gem.add_runtime_dependency("event_spitter")
21
23
  end
data/lib/firmata/board.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'stringio'
2
2
  require 'event_spitter'
3
+ require "firmata/event"
3
4
 
4
5
  module Firmata
5
6
  class Board
@@ -82,7 +83,7 @@ module Firmata
82
83
  attr_reader :analog_pins
83
84
  # Public: Returns the String firmware name of Arduion.
84
85
  attr_reader :firmware_name
85
- # Public: Returns array of any Events returned from
86
+ # Public: Returns array of any Events returned from
86
87
  attr_reader :async_events
87
88
 
88
89
  # Public: Initialize a Board
@@ -469,7 +470,7 @@ module Firmata
469
470
 
470
471
  def i2c_write_request(slave_address, *data)
471
472
  address = [slave_address].pack("v")
472
- ret = [START_SYSEX, I2C_REQUEST, address[0], (I2C_MODE_WRITE << 3)]
473
+ ret = [START_SYSEX, I2C_REQUEST, address[0], (I2C_MODE_WRITE << 3)]
473
474
  data.each do |n|
474
475
  ret.push([n].pack("v")[0])
475
476
  ret.push([n].pack("v")[1])
@@ -1,3 +1,3 @@
1
1
  module Firmata
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
data/test/board_test.rb CHANGED
@@ -8,7 +8,7 @@ class BoardTest < MiniTest::Unit::TestCase
8
8
 
9
9
  def mock_serial_port(*args, &block)
10
10
  mock_port = MiniTest::Mock.new
11
- mock_port.expect(:is_a?, false, [nil])
11
+ mock_port.expect(:is_a?, false, [String])
12
12
 
13
13
  if block_given?
14
14
  yield mock_port
metadata CHANGED
@@ -1,46 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hybridgroup-firmata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
5
- prerelease:
4
+ version: 0.4.2
6
5
  platform: ruby
7
6
  authors:
8
- - ! '''Mike Breen'', ''Adrian Zankich'''
7
+ - '''Mike Breen'', ''Adrian Zankich'', ''Ron Evans'', ''Isaac A. Murchie'''
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-26 00:00:00.000000000 Z
11
+ date: 2013-08-15 00:00:00.000000000 Z
13
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
14
27
  - !ruby/object:Gem::Dependency
15
28
  name: pry
16
29
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
30
  requirements:
19
- - - ! '>='
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
20
46
  - !ruby/object:Gem::Version
21
47
  version: '0'
22
48
  type: :development
23
49
  prerelease: false
24
50
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
51
  requirements:
27
- - - ! '>='
52
+ - - '>='
28
53
  - !ruby/object:Gem::Version
29
54
  version: '0'
30
55
  - !ruby/object:Gem::Dependency
31
56
  name: event_spitter
32
57
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
58
  requirements:
35
- - - ! '>='
59
+ - - '>='
36
60
  - !ruby/object:Gem::Version
37
61
  version: '0'
38
62
  type: :runtime
39
63
  prerelease: false
40
64
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
65
  requirements:
43
- - - ! '>='
66
+ - - '>='
44
67
  - !ruby/object:Gem::Version
45
68
  version: '0'
46
69
  description: A lib for working with the Firmata protocol in Ruby.
@@ -51,12 +74,16 @@ extensions: []
51
74
  extra_rdoc_files: []
52
75
  files:
53
76
  - .gitignore
77
+ - .travis.yml
54
78
  - Gemfile
79
+ - Gemfile.lock
55
80
  - LICENSE
56
81
  - README.md
57
82
  - Rakefile
58
83
  - examples/blink_led.rb
84
+ - examples/blink_led_socket.rb
59
85
  - examples/digital_read.rb
86
+ - examples/digital_read_socket.rb
60
87
  - examples/wiichuck_read.rb
61
88
  - firmata.gemspec
62
89
  - lib/firmata.rb
@@ -67,27 +94,26 @@ files:
67
94
  - test/fake_serial_port.rb
68
95
  homepage: ''
69
96
  licenses: []
97
+ metadata: {}
70
98
  post_install_message:
71
99
  rdoc_options: []
72
100
  require_paths:
73
101
  - lib
74
102
  required_ruby_version: !ruby/object:Gem::Requirement
75
- none: false
76
103
  requirements:
77
- - - ! '>='
104
+ - - '>='
78
105
  - !ruby/object:Gem::Version
79
106
  version: '0'
80
107
  required_rubygems_version: !ruby/object:Gem::Requirement
81
- none: false
82
108
  requirements:
83
- - - ! '>='
109
+ - - '>='
84
110
  - !ruby/object:Gem::Version
85
111
  version: '0'
86
112
  requirements: []
87
113
  rubyforge_project:
88
- rubygems_version: 1.8.24
114
+ rubygems_version: 2.0.3
89
115
  signing_key:
90
- specification_version: 3
116
+ specification_version: 4
91
117
  summary: ''
92
118
  test_files:
93
119
  - test/board_test.rb