arduino_firmata 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +5 -0
- data/Manifest.txt +1 -0
- data/lib/arduino_firmata.rb +1 -1
- data/lib/arduino_firmata/arduino.rb +1 -1
- data/samples/README.md +10 -0
- data/samples/sinatra_arduino.rb +23 -0
- metadata +3 -2
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/lib/arduino_firmata.rb
CHANGED
@@ -68,7 +68,7 @@ module ArduinoFirmata
|
|
68
68
|
|
69
69
|
def digital_write(pin, value)
|
70
70
|
port_num = (pin >> 3) & 0x0F
|
71
|
-
if value == 0 or value ==
|
71
|
+
if value == 0 or value == false
|
72
72
|
@digital_output_data[port_num] &= ~(1 << (pin & 0x07))
|
73
73
|
else
|
74
74
|
@digital_output_data[port_num] |= (1 << (pin & 0x07))
|
data/samples/README.md
CHANGED
@@ -6,6 +6,7 @@ Digital/Analog IO
|
|
6
6
|
- digital_read.rb
|
7
7
|
- led_blink.rb
|
8
8
|
- led_fade.rb
|
9
|
+
- on_changed.rb
|
9
10
|
|
10
11
|
|
11
12
|
Tweet Temperature
|
@@ -14,3 +15,12 @@ Tweet Temperature
|
|
14
15
|
% gem install tw
|
15
16
|
% tw --user:add
|
16
17
|
% ruby tweet_temperature.rb
|
18
|
+
|
19
|
+
|
20
|
+
Sinatra Arduino
|
21
|
+
---------------
|
22
|
+
|
23
|
+
% gem install sinatra
|
24
|
+
% ruby sinatra_arduino.rb
|
25
|
+
|
26
|
+
=> http://localhost:4567
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift File.expand_path '../lib', File.dirname(__FILE__)
|
3
|
+
require 'rubygems'
|
4
|
+
require 'sinatra'
|
5
|
+
require 'arduino_firmata'
|
6
|
+
|
7
|
+
arduino = ArduinoFirmata.connect
|
8
|
+
|
9
|
+
get '/' do
|
10
|
+
redirect './on'
|
11
|
+
end
|
12
|
+
|
13
|
+
get '/on' do
|
14
|
+
analog = arduino.analog_read(0)
|
15
|
+
arduino.digital_write 13, ArduinoFirmata::HIGH
|
16
|
+
"<p>analog : #{analog}</p><p><a href='./off'>off</a></p>"
|
17
|
+
end
|
18
|
+
|
19
|
+
get '/off' do
|
20
|
+
analog = arduino.analog_read(0)
|
21
|
+
arduino.digital_write 13, ArduinoFirmata::LOW
|
22
|
+
"<p>analog : #{analog}</p><p><a href='./on'>on</a></p>"
|
23
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arduino_firmata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -110,6 +110,7 @@ files:
|
|
110
110
|
- samples/led_blink.rb
|
111
111
|
- samples/led_fade.rb
|
112
112
|
- samples/on_changed.rb
|
113
|
+
- samples/sinatra_arduino.rb
|
113
114
|
- samples/tweet_temperature.rb
|
114
115
|
- script/console
|
115
116
|
- script/destroy
|
@@ -134,7 +135,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
134
135
|
version: '0'
|
135
136
|
segments:
|
136
137
|
- 0
|
137
|
-
hash: -
|
138
|
+
hash: -4559901712917209953
|
138
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
140
|
none: false
|
140
141
|
requirements:
|