arduino_firmata 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +4 -0
- data/lib/arduino_firmata/arduino.rb +8 -0
- data/lib/arduino_firmata/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb79730f81ce6d1e5cf252847c00bc6667cd46e4
|
4
|
+
data.tar.gz: 9f589cb5dbff2f8a143cdf8e29f1ae4890a3d8c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab7369bd8c68814f5273076fa845558e38531803c48a00454e0425a727edf33293f24307c1844f18b45c780f47f03bdb3f79bcbae2d12d7b6752e46f3ce7b92e
|
7
|
+
data.tar.gz: a8247133ee445fdab29b976f42a65ef5006b15af57950e56d47f573e8f285af82c585d149d3306df64823d1dfc2084c7b0a0d7da13f0a87126693e6d0b96ef5a
|
data/History.txt
CHANGED
@@ -105,14 +105,17 @@ module ArduinoFirmata
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def digital_read(pin)
|
108
|
+
raise ArgumentError, "invalid pin number (#{pin})" if pin.class != Fixnum or pin < 0
|
108
109
|
(@digital_input_data[pin >> 3] >> (pin & 0x07)) & 0x01 > 0
|
109
110
|
end
|
110
111
|
|
111
112
|
def analog_read(pin)
|
113
|
+
raise ArgumentError, "invalid pin number (#{pin})" if pin.class != Fixnum or pin < 0
|
112
114
|
@analog_input_data[pin]
|
113
115
|
end
|
114
116
|
|
115
117
|
def pin_mode(pin, mode)
|
118
|
+
raise ArgumentError, "invalid pin number (#{pin})" if pin.class != Fixnum or pin < 0
|
116
119
|
write SET_PIN_MODE
|
117
120
|
write pin
|
118
121
|
mode = case mode
|
@@ -129,6 +132,7 @@ module ArduinoFirmata
|
|
129
132
|
end
|
130
133
|
|
131
134
|
def digital_write(pin, value)
|
135
|
+
raise ArgumentError, "invalid pin number (#{pin})" if pin.class != Fixnum or pin < 0
|
132
136
|
pin_mode pin, OUTPUT
|
133
137
|
port_num = (pin >> 3) & 0x0F
|
134
138
|
if value == 0 or value == false
|
@@ -145,6 +149,8 @@ module ArduinoFirmata
|
|
145
149
|
end
|
146
150
|
|
147
151
|
def analog_write(pin, value)
|
152
|
+
raise ArgumentError, "invalid pin number (#{pin})" if pin.class != Fixnum or pin < 0
|
153
|
+
raise ArgumentError, "invalid analog value (#{value})" if value.class != Fixnum or value < 0
|
148
154
|
pin_mode pin, PWM
|
149
155
|
write(ANALOG_MESSAGE | (pin & 0x0F))
|
150
156
|
write(value & 0x7F)
|
@@ -154,6 +160,8 @@ module ArduinoFirmata
|
|
154
160
|
end
|
155
161
|
|
156
162
|
def servo_write(pin, angle)
|
163
|
+
raise ArgumentError, "invalid pin number (#{pin})" if pin.class != Fixnum or pin < 0
|
164
|
+
raise ArgumentError, "invalid angle (#{angle})" if angle.class != Fixnum or angle < 0
|
157
165
|
pin_mode pin, SERVO
|
158
166
|
write(ANALOG_MESSAGE | (pin & 0x0F))
|
159
167
|
write(angle & 0x7F)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arduino_firmata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
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-
|
11
|
+
date: 2013-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
173
|
version: '0'
|
174
174
|
requirements: []
|
175
175
|
rubyforge_project:
|
176
|
-
rubygems_version: 2.
|
176
|
+
rubygems_version: 2.1.5
|
177
177
|
signing_key:
|
178
178
|
specification_version: 4
|
179
179
|
summary: Arduino Firmata protocol (http://firmata.org) implementation on Ruby.
|