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 +7 -0
- data/.gitignore +0 -1
- data/.travis.yml +6 -0
- data/Gemfile.lock +28 -0
- data/README.md +2 -0
- data/examples/blink_led.rb +1 -4
- data/examples/blink_led_socket.rb +23 -0
- data/examples/digital_read.rb +1 -4
- data/examples/digital_read_socket.rb +24 -0
- data/firmata.gemspec +3 -1
- data/lib/firmata/board.rb +3 -2
- data/lib/firmata/version.rb +1 -1
- data/test/board_test.rb +1 -1
- metadata +44 -18
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
data/.travis.yml
ADDED
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:
|
data/examples/blink_led.rb
CHANGED
@@ -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
|
data/examples/digital_read.rb
CHANGED
@@ -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])
|
data/lib/firmata/version.rb
CHANGED
data/test/board_test.rb
CHANGED
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.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
|
-
-
|
7
|
+
- '''Mike Breen'', ''Adrian Zankich'', ''Ron Evans'', ''Isaac A. Murchie'''
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
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:
|
114
|
+
rubygems_version: 2.0.3
|
89
115
|
signing_key:
|
90
|
-
specification_version:
|
116
|
+
specification_version: 4
|
91
117
|
summary: ''
|
92
118
|
test_files:
|
93
119
|
- test/board_test.rb
|