raspberry_pi_iot 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.
- checksums.yaml +4 -4
- data/doc/Actuator.html +1 -1
- data/doc/BH1750.html +1 -1
- data/doc/BME280.html +4 -4
- data/doc/BMP280.html +4 -4
- data/doc/BMxSensor.html +16 -16
- data/doc/BinaryActuator.html +3 -3
- data/doc/BinaryEffector.html +1 -1
- data/doc/BinaryReceptor.html +1 -1
- data/doc/BinarySensor.html +2 -2
- data/doc/Bus.html +1 -1
- data/doc/Button.html +1 -1
- data/doc/DHT11.html +1 -1
- data/doc/DHT22.html +1 -1
- data/doc/DHTxxSensor.html +1 -1
- data/doc/DS18B20.html +1 -1
- data/doc/DigitalActuator.html +1 -1
- data/doc/DigitalEffector.html +2 -2
- data/doc/DigitalReceptor.html +1 -1
- data/doc/DigitalSensor.html +1 -1
- data/doc/Effector.html +1 -1
- data/doc/HCSR501.html +1 -1
- data/doc/HumitureSensor.html +1 -1
- data/doc/IoT.html +1 -1
- data/doc/LED.html +1 -1
- data/doc/MAX44009.html +1 -1
- data/doc/RaspberryPi.html +1 -1
- data/doc/Receptor.html +1 -1
- data/doc/Sensor.html +1 -1
- data/doc/TemperatureSensor.html +1 -1
- data/doc/_index.html +1 -1
- data/doc/file.README.html +37 -6
- data/doc/index.html +37 -6
- data/doc/top-level-namespace.html +1 -1
- data/lib/binary_actuator.rb +5 -0
- data/lib/binary_effector.rb +0 -4
- data/lib/binary_receptor.rb +0 -4
- data/lib/binary_sensor.rb +5 -0
- data/lib/bmx_sensor.rb +0 -1
- data/lib/digital_effector.rb +18 -1
- data/test/standalone_test_bmp280.rb +53 -0
- data/test/test_bh1750.rb +31 -0
- data/test/test_button.rb +41 -0
- data/test/test_dht11.rb +35 -0
- data/test/test_ds18b20.rb +28 -0
- data/test/test_info.rb +22 -0
- data/test/test_led.rb +46 -0
- data/test/test_led_rgb.rb +62 -0
- data/test/test_max44009_gy49.rb +31 -0
- metadata +13 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4bbb4473d2a821ebbba305c96d5392f00f85d866
|
|
4
|
+
data.tar.gz: d54efa33efb3345ac5833f9b9467aa8d5e5f59c3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3c9f8f68cd52030a5ec2382a98c4d9d7471a2d22de4a8a7e28795588bc2ee8c38eae8509d27551452ed4f0d1ed594e914ad8fb1c758be07bd44a7d94af30e28c
|
|
7
|
+
data.tar.gz: d0ad65235290907aa16c280f7a9565793381b88f39eeb39a69d5903ed4da958060d4faafae62d65e61df5c936efb3cb3e425bd902659a7fbc9b7d753ebeb53c9
|
data/doc/Actuator.html
CHANGED
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
</div>
|
|
136
136
|
|
|
137
137
|
<div id="footer">
|
|
138
|
-
Generated on
|
|
138
|
+
Generated on Tue Dec 18 16:03:46 2018 by
|
|
139
139
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
140
140
|
0.9.16 (ruby-2.3.3).
|
|
141
141
|
</div>
|
data/doc/BH1750.html
CHANGED
|
@@ -531,7 +531,7 @@
|
|
|
531
531
|
</div>
|
|
532
532
|
|
|
533
533
|
<div id="footer">
|
|
534
|
-
Generated on
|
|
534
|
+
Generated on Tue Dec 18 16:03:39 2018 by
|
|
535
535
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
536
536
|
0.9.16 (ruby-2.3.3).
|
|
537
537
|
</div>
|
data/doc/BME280.html
CHANGED
|
@@ -245,12 +245,12 @@
|
|
|
245
245
|
<pre class="lines">
|
|
246
246
|
|
|
247
247
|
|
|
248
|
+
82
|
|
248
249
|
83
|
|
249
|
-
84
|
|
250
|
-
85</pre>
|
|
250
|
+
84</pre>
|
|
251
251
|
</td>
|
|
252
252
|
<td>
|
|
253
|
-
<pre class="code"><span class="info file"># File 'lib/bmx_sensor.rb', line
|
|
253
|
+
<pre class="code"><span class="info file"># File 'lib/bmx_sensor.rb', line 82</span>
|
|
254
254
|
|
|
255
255
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
|
256
256
|
<span class='kw'>super</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>BME280</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
|
@@ -266,7 +266,7 @@
|
|
|
266
266
|
</div>
|
|
267
267
|
|
|
268
268
|
<div id="footer">
|
|
269
|
-
Generated on
|
|
269
|
+
Generated on Tue Dec 18 16:03:41 2018 by
|
|
270
270
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
271
271
|
0.9.16 (ruby-2.3.3).
|
|
272
272
|
</div>
|
data/doc/BMP280.html
CHANGED
|
@@ -245,12 +245,12 @@
|
|
|
245
245
|
<pre class="lines">
|
|
246
246
|
|
|
247
247
|
|
|
248
|
+
76
|
|
248
249
|
77
|
|
249
|
-
78
|
|
250
|
-
79</pre>
|
|
250
|
+
78</pre>
|
|
251
251
|
</td>
|
|
252
252
|
<td>
|
|
253
|
-
<pre class="code"><span class="info file"># File 'lib/bmx_sensor.rb', line
|
|
253
|
+
<pre class="code"><span class="info file"># File 'lib/bmx_sensor.rb', line 76</span>
|
|
254
254
|
|
|
255
255
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
|
256
256
|
<span class='kw'>super</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>BMP280</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
|
@@ -266,7 +266,7 @@
|
|
|
266
266
|
</div>
|
|
267
267
|
|
|
268
268
|
<div id="footer">
|
|
269
|
-
Generated on
|
|
269
|
+
Generated on Tue Dec 18 16:03:40 2018 by
|
|
270
270
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
271
271
|
0.9.16 (ruby-2.3.3).
|
|
272
272
|
</div>
|
data/doc/BMxSensor.html
CHANGED
|
@@ -338,14 +338,14 @@
|
|
|
338
338
|
<pre class="lines">
|
|
339
339
|
|
|
340
340
|
|
|
341
|
+
10
|
|
341
342
|
11
|
|
342
343
|
12
|
|
343
344
|
13
|
|
344
|
-
14
|
|
345
|
-
15</pre>
|
|
345
|
+
14</pre>
|
|
346
346
|
</td>
|
|
347
347
|
<td>
|
|
348
|
-
<pre class="code"><span class="info file"># File 'lib/bmx_sensor.rb', line
|
|
348
|
+
<pre class="code"><span class="info file"># File 'lib/bmx_sensor.rb', line 10</span>
|
|
349
349
|
|
|
350
350
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_sensor_name'>sensor_name</span><span class='comma'>,</span> <span class='id identifier rubyid_bus'>bus</span><span class='op'>=</span><span class='int'>1</span><span class='rparen'>)</span>
|
|
351
351
|
<span class='ivar'>@sensor_name</span> <span class='op'>=</span> <span class='id identifier rubyid_sensor_name'>sensor_name</span>
|
|
@@ -391,12 +391,12 @@
|
|
|
391
391
|
<pre class="lines">
|
|
392
392
|
|
|
393
393
|
|
|
394
|
+
25
|
|
394
395
|
26
|
|
395
|
-
27
|
|
396
|
-
28</pre>
|
|
396
|
+
27</pre>
|
|
397
397
|
</td>
|
|
398
398
|
<td>
|
|
399
|
-
<pre class="code"><span class="info file"># File 'lib/bmx_sensor.rb', line
|
|
399
|
+
<pre class="code"><span class="info file"># File 'lib/bmx_sensor.rb', line 25</span>
|
|
400
400
|
|
|
401
401
|
<span class='kw'>def</span> <span class='id identifier rubyid_hPa'>hPa</span>
|
|
402
402
|
<span class='ivar'>@pressure</span>
|
|
@@ -421,6 +421,7 @@
|
|
|
421
421
|
<pre class="lines">
|
|
422
422
|
|
|
423
423
|
|
|
424
|
+
29
|
|
424
425
|
30
|
|
425
426
|
31
|
|
426
427
|
32
|
|
@@ -441,11 +442,10 @@
|
|
|
441
442
|
47
|
|
442
443
|
48
|
|
443
444
|
49
|
|
444
|
-
50
|
|
445
|
-
51</pre>
|
|
445
|
+
50</pre>
|
|
446
446
|
</td>
|
|
447
447
|
<td>
|
|
448
|
-
<pre class="code"><span class="info file"># File 'lib/bmx_sensor.rb', line
|
|
448
|
+
<pre class="code"><span class="info file"># File 'lib/bmx_sensor.rb', line 29</span>
|
|
449
449
|
|
|
450
450
|
<span class='kw'>def</span> <span class='id identifier rubyid_pressure'>pressure</span><span class='lparen'>(</span><span class='id identifier rubyid_mode'>mode</span><span class='op'>=</span><span class='symbol'>:hPa</span><span class='rparen'>)</span>
|
|
451
451
|
<span class='kw'>case</span> <span class='id identifier rubyid_mode'>mode</span>
|
|
@@ -489,16 +489,16 @@
|
|
|
489
489
|
<pre class="lines">
|
|
490
490
|
|
|
491
491
|
|
|
492
|
+
16
|
|
492
493
|
17
|
|
493
494
|
18
|
|
494
495
|
19
|
|
495
496
|
20
|
|
496
497
|
21
|
|
497
|
-
22
|
|
498
|
-
23</pre>
|
|
498
|
+
22</pre>
|
|
499
499
|
</td>
|
|
500
500
|
<td>
|
|
501
|
-
<pre class="code"><span class="info file"># File 'lib/bmx_sensor.rb', line
|
|
501
|
+
<pre class="code"><span class="info file"># File 'lib/bmx_sensor.rb', line 16</span>
|
|
502
502
|
|
|
503
503
|
<span class='kw'>def</span> <span class='id identifier rubyid_read_data'>read_data</span>
|
|
504
504
|
<span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='ivar'>@sensor</span><span class='period'>.</span><span class='id identifier rubyid_all'>all</span>
|
|
@@ -527,12 +527,12 @@
|
|
|
527
527
|
<pre class="lines">
|
|
528
528
|
|
|
529
529
|
|
|
530
|
+
52
|
|
530
531
|
53
|
|
531
|
-
54
|
|
532
|
-
55</pre>
|
|
532
|
+
54</pre>
|
|
533
533
|
</td>
|
|
534
534
|
<td>
|
|
535
|
-
<pre class="code"><span class="info file"># File 'lib/bmx_sensor.rb', line
|
|
535
|
+
<pre class="code"><span class="info file"># File 'lib/bmx_sensor.rb', line 52</span>
|
|
536
536
|
|
|
537
537
|
<span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
|
|
538
538
|
<span class='id identifier rubyid_sprintf'>sprintf</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%5.2f°C, %5.2f %%, %5.2f mmHg</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='ivar'>@temperature</span><span class='comma'>,</span> <span class='ivar'>@humidity</span><span class='comma'>,</span> <span class='id identifier rubyid_pressure'>pressure</span><span class='lparen'>(</span><span class='symbol'>:mmHg</span><span class='rparen'>)</span>
|
|
@@ -547,7 +547,7 @@
|
|
|
547
547
|
</div>
|
|
548
548
|
|
|
549
549
|
<div id="footer">
|
|
550
|
-
Generated on
|
|
550
|
+
Generated on Tue Dec 18 16:03:40 2018 by
|
|
551
551
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
552
552
|
0.9.16 (ruby-2.3.3).
|
|
553
553
|
</div>
|
data/doc/BinaryActuator.html
CHANGED
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
|
|
101
101
|
<dl>
|
|
102
102
|
<dt>Defined in:</dt>
|
|
103
|
-
<dd>lib/
|
|
103
|
+
<dd>lib/binary_actuator.rb</dd>
|
|
104
104
|
</dl>
|
|
105
105
|
|
|
106
106
|
</div>
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
<h2>Overview</h2><div class="docstring">
|
|
109
109
|
<div class="discussion">
|
|
110
110
|
|
|
111
|
-
<p>BinaryActuator - synomym for BinaryEffector</p>
|
|
111
|
+
<p>BinaryActuator - a synomym for BinaryEffector</p>
|
|
112
112
|
|
|
113
113
|
|
|
114
114
|
</div>
|
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
</div>
|
|
168
168
|
|
|
169
169
|
<div id="footer">
|
|
170
|
-
Generated on
|
|
170
|
+
Generated on Tue Dec 18 16:03:39 2018 by
|
|
171
171
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
172
172
|
0.9.16 (ruby-2.3.3).
|
|
173
173
|
</div>
|
data/doc/BinaryEffector.html
CHANGED
|
@@ -236,7 +236,7 @@
|
|
|
236
236
|
</div>
|
|
237
237
|
|
|
238
238
|
<div id="footer">
|
|
239
|
-
Generated on
|
|
239
|
+
Generated on Tue Dec 18 16:03:39 2018 by
|
|
240
240
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
241
241
|
0.9.16 (ruby-2.3.3).
|
|
242
242
|
</div>
|
data/doc/BinaryReceptor.html
CHANGED
|
@@ -377,7 +377,7 @@
|
|
|
377
377
|
</div>
|
|
378
378
|
|
|
379
379
|
<div id="footer">
|
|
380
|
-
Generated on
|
|
380
|
+
Generated on Tue Dec 18 16:03:39 2018 by
|
|
381
381
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
382
382
|
0.9.16 (ruby-2.3.3).
|
|
383
383
|
</div>
|
data/doc/BinarySensor.html
CHANGED
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
|
|
99
99
|
<dl>
|
|
100
100
|
<dt>Defined in:</dt>
|
|
101
|
-
<dd>lib/
|
|
101
|
+
<dd>lib/binary_sensor.rb</dd>
|
|
102
102
|
</dl>
|
|
103
103
|
|
|
104
104
|
</div>
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
</div>
|
|
159
159
|
|
|
160
160
|
<div id="footer">
|
|
161
|
-
Generated on
|
|
161
|
+
Generated on Tue Dec 18 16:03:39 2018 by
|
|
162
162
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
163
163
|
0.9.16 (ruby-2.3.3).
|
|
164
164
|
</div>
|
data/doc/Bus.html
CHANGED
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
</div>
|
|
117
117
|
|
|
118
118
|
<div id="footer">
|
|
119
|
-
Generated on
|
|
119
|
+
Generated on Tue Dec 18 16:03:38 2018 by
|
|
120
120
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
121
121
|
0.9.16 (ruby-2.3.3).
|
|
122
122
|
</div>
|
data/doc/Button.html
CHANGED
|
@@ -976,7 +976,7 @@
|
|
|
976
976
|
</div>
|
|
977
977
|
|
|
978
978
|
<div id="footer">
|
|
979
|
-
Generated on
|
|
979
|
+
Generated on Tue Dec 18 16:03:42 2018 by
|
|
980
980
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
981
981
|
0.9.16 (ruby-2.3.3).
|
|
982
982
|
</div>
|
data/doc/DHT11.html
CHANGED
|
@@ -277,7 +277,7 @@
|
|
|
277
277
|
</div>
|
|
278
278
|
|
|
279
279
|
<div id="footer">
|
|
280
|
-
Generated on
|
|
280
|
+
Generated on Tue Dec 18 16:03:44 2018 by
|
|
281
281
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
282
282
|
0.9.16 (ruby-2.3.3).
|
|
283
283
|
</div>
|
data/doc/DHT22.html
CHANGED
|
@@ -277,7 +277,7 @@
|
|
|
277
277
|
</div>
|
|
278
278
|
|
|
279
279
|
<div id="footer">
|
|
280
|
-
Generated on
|
|
280
|
+
Generated on Tue Dec 18 16:03:45 2018 by
|
|
281
281
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
282
282
|
0.9.16 (ruby-2.3.3).
|
|
283
283
|
</div>
|
data/doc/DHTxxSensor.html
CHANGED
|
@@ -351,7 +351,7 @@
|
|
|
351
351
|
</div>
|
|
352
352
|
|
|
353
353
|
<div id="footer">
|
|
354
|
-
Generated on
|
|
354
|
+
Generated on Tue Dec 18 16:03:43 2018 by
|
|
355
355
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
356
356
|
0.9.16 (ruby-2.3.3).
|
|
357
357
|
</div>
|
data/doc/DS18B20.html
CHANGED
|
@@ -329,7 +329,7 @@
|
|
|
329
329
|
</div>
|
|
330
330
|
|
|
331
331
|
<div id="footer">
|
|
332
|
-
Generated on
|
|
332
|
+
Generated on Tue Dec 18 16:03:46 2018 by
|
|
333
333
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
334
334
|
0.9.16 (ruby-2.3.3).
|
|
335
335
|
</div>
|
data/doc/DigitalActuator.html
CHANGED
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
</div>
|
|
155
155
|
|
|
156
156
|
<div id="footer">
|
|
157
|
-
Generated on
|
|
157
|
+
Generated on Tue Dec 18 16:03:45 2018 by
|
|
158
158
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
159
159
|
0.9.16 (ruby-2.3.3).
|
|
160
160
|
</div>
|
data/doc/DigitalEffector.html
CHANGED
|
@@ -518,7 +518,7 @@
|
|
|
518
518
|
<pre class="code"><span class="info file"># File 'lib/digital_effector.rb', line 49</span>
|
|
519
519
|
|
|
520
520
|
<span class='kw'>def</span> <span class='id identifier rubyid_off?'>off?</span><span class='lparen'>(</span><span class='id identifier rubyid_pin'>pin</span><span class='op'>=</span><span class='ivar'>@pin</span><span class='rparen'>)</span>
|
|
521
|
-
<span class='op'>!</span><span class='id identifier rubyid_on'>on
|
|
521
|
+
<span class='op'>!</span><span class='id identifier rubyid_on?'>on?</span><span class='lparen'>(</span><span class='id identifier rubyid_pin'>pin</span><span class='rparen'>)</span>
|
|
522
522
|
<span class='kw'>end</span></pre>
|
|
523
523
|
</td>
|
|
524
524
|
</tr>
|
|
@@ -626,7 +626,7 @@
|
|
|
626
626
|
</div>
|
|
627
627
|
|
|
628
628
|
<div id="footer">
|
|
629
|
-
Generated on
|
|
629
|
+
Generated on Tue Dec 18 16:03:45 2018 by
|
|
630
630
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
631
631
|
0.9.16 (ruby-2.3.3).
|
|
632
632
|
</div>
|
data/doc/DigitalReceptor.html
CHANGED
|
@@ -232,7 +232,7 @@
|
|
|
232
232
|
</div>
|
|
233
233
|
|
|
234
234
|
<div id="footer">
|
|
235
|
-
Generated on
|
|
235
|
+
Generated on Tue Dec 18 16:03:45 2018 by
|
|
236
236
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
237
237
|
0.9.16 (ruby-2.3.3).
|
|
238
238
|
</div>
|
data/doc/DigitalSensor.html
CHANGED
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
</div>
|
|
153
153
|
|
|
154
154
|
<div id="footer">
|
|
155
|
-
Generated on
|
|
155
|
+
Generated on Tue Dec 18 16:03:45 2018 by
|
|
156
156
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
157
157
|
0.9.16 (ruby-2.3.3).
|
|
158
158
|
</div>
|
data/doc/Effector.html
CHANGED
|
@@ -247,7 +247,7 @@
|
|
|
247
247
|
</div>
|
|
248
248
|
|
|
249
249
|
<div id="footer">
|
|
250
|
-
Generated on
|
|
250
|
+
Generated on Tue Dec 18 16:03:46 2018 by
|
|
251
251
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
252
252
|
0.9.16 (ruby-2.3.3).
|
|
253
253
|
</div>
|
data/doc/HCSR501.html
CHANGED
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
</div>
|
|
163
163
|
|
|
164
164
|
<div id="footer">
|
|
165
|
-
Generated on
|
|
165
|
+
Generated on Tue Dec 18 16:03:46 2018 by
|
|
166
166
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
167
167
|
0.9.16 (ruby-2.3.3).
|
|
168
168
|
</div>
|
data/doc/HumitureSensor.html
CHANGED
|
@@ -443,7 +443,7 @@
|
|
|
443
443
|
</div>
|
|
444
444
|
|
|
445
445
|
<div id="footer">
|
|
446
|
-
Generated on
|
|
446
|
+
Generated on Tue Dec 18 16:03:47 2018 by
|
|
447
447
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
448
448
|
0.9.16 (ruby-2.3.3).
|
|
449
449
|
</div>
|
data/doc/IoT.html
CHANGED
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
</div>
|
|
117
117
|
|
|
118
118
|
<div id="footer">
|
|
119
|
-
Generated on
|
|
119
|
+
Generated on Tue Dec 18 16:03:38 2018 by
|
|
120
120
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
121
121
|
0.9.16 (ruby-2.3.3).
|
|
122
122
|
</div>
|
data/doc/LED.html
CHANGED
|
@@ -774,7 +774,7 @@ secs, then pause for 'switched_off' secs</p>
|
|
|
774
774
|
</div>
|
|
775
775
|
|
|
776
776
|
<div id="footer">
|
|
777
|
-
Generated on
|
|
777
|
+
Generated on Tue Dec 18 16:03:48 2018 by
|
|
778
778
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
779
779
|
0.9.16 (ruby-2.3.3).
|
|
780
780
|
</div>
|
data/doc/MAX44009.html
CHANGED
|
@@ -820,7 +820,7 @@ applications</p>
|
|
|
820
820
|
</div>
|
|
821
821
|
|
|
822
822
|
<div id="footer">
|
|
823
|
-
Generated on
|
|
823
|
+
Generated on Tue Dec 18 16:03:49 2018 by
|
|
824
824
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
825
825
|
0.9.16 (ruby-2.3.3).
|
|
826
826
|
</div>
|
data/doc/RaspberryPi.html
CHANGED
|
@@ -307,7 +307,7 @@ href="https://www.raspberrypi-spy.co.uk/2012/09/checking-your-raspberry-pi-board
|
|
|
307
307
|
</div>
|
|
308
308
|
|
|
309
309
|
<div id="footer">
|
|
310
|
-
Generated on
|
|
310
|
+
Generated on Tue Dec 18 16:03:39 2018 by
|
|
311
311
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
312
312
|
0.9.16 (ruby-2.3.3).
|
|
313
313
|
</div>
|
data/doc/Receptor.html
CHANGED
|
@@ -247,7 +247,7 @@
|
|
|
247
247
|
</div>
|
|
248
248
|
|
|
249
249
|
<div id="footer">
|
|
250
|
-
Generated on
|
|
250
|
+
Generated on Tue Dec 18 16:03:49 2018 by
|
|
251
251
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
252
252
|
0.9.16 (ruby-2.3.3).
|
|
253
253
|
</div>
|
data/doc/Sensor.html
CHANGED
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
</div>
|
|
136
136
|
|
|
137
137
|
<div id="footer">
|
|
138
|
-
Generated on
|
|
138
|
+
Generated on Tue Dec 18 16:03:49 2018 by
|
|
139
139
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
140
140
|
0.9.16 (ruby-2.3.3).
|
|
141
141
|
</div>
|
data/doc/TemperatureSensor.html
CHANGED
|
@@ -634,7 +634,7 @@
|
|
|
634
634
|
</div>
|
|
635
635
|
|
|
636
636
|
<div id="footer">
|
|
637
|
-
Generated on
|
|
637
|
+
Generated on Tue Dec 18 16:03:50 2018 by
|
|
638
638
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
639
639
|
0.9.16 (ruby-2.3.3).
|
|
640
640
|
</div>
|
data/doc/_index.html
CHANGED
|
@@ -385,7 +385,7 @@
|
|
|
385
385
|
</div>
|
|
386
386
|
|
|
387
387
|
<div id="footer">
|
|
388
|
-
Generated on
|
|
388
|
+
Generated on Tue Dec 18 16:03:36 2018 by
|
|
389
389
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
390
390
|
0.9.16 (ruby-2.3.3).
|
|
391
391
|
</div>
|
data/doc/file.README.html
CHANGED
|
@@ -62,15 +62,46 @@
|
|
|
62
62
|
|
|
63
63
|
<p>A Ruby library for IoT (physical computing) projects with Raspberry Pi.</p>
|
|
64
64
|
|
|
65
|
-
<p>Why I made it
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
<p>Why I made it.</p>
|
|
66
|
+
|
|
67
|
+
<p>I'm a software developer and a maker. And I do love Raspberry Pi -
|
|
68
|
+
it's such a fun to do physical programming! But I love to program in
|
|
69
|
+
Ruby. So I tried to make a pragmatic set of useful IoT libraries for the
|
|
70
|
+
Ruby language for all who want to program for Raspberry Pi in Ruby.</p>
|
|
71
|
+
|
|
72
|
+
<p>To use this library you should do:</p>
|
|
73
|
+
<ol><li>
|
|
74
|
+
<p>Install the Ruby development version (to compile the extensions):</p>
|
|
75
|
+
</li></ol>
|
|
76
|
+
|
|
77
|
+
<p>sudo apt-get install ruby-dev</p>
|
|
78
|
+
<ol><li>
|
|
79
|
+
<p>Download and install the bcm2835-1.xx.tar.gz library:</p>
|
|
80
|
+
</li></ol>
|
|
81
|
+
|
|
82
|
+
<p>wget <a
|
|
83
|
+
href="http://www.airspayce.com/mikem/bcm2835/bcm2835-1.58.tar.gz">www.airspayce.com/mikem/bcm2835/bcm2835-1.58.tar.gz</a></p>
|
|
84
|
+
|
|
85
|
+
<p>tar zxvf bcm2835-1.xx.tar.gz</p>
|
|
86
|
+
|
|
87
|
+
<p>cd bcm2835-1.xx</p>
|
|
88
|
+
|
|
89
|
+
<p>./configure</p>
|
|
90
|
+
|
|
91
|
+
<p>make</p>
|
|
92
|
+
|
|
93
|
+
<p>sudo make check</p>
|
|
94
|
+
|
|
95
|
+
<p>sudo make install</p>
|
|
96
|
+
<ol><li>
|
|
97
|
+
<p>Install the latest version of gem:</p>
|
|
98
|
+
</li></ol>
|
|
99
|
+
|
|
100
|
+
<p>sudo gem install raspberry_pi_iot.gem</p>
|
|
70
101
|
</div></div>
|
|
71
102
|
|
|
72
103
|
<div id="footer">
|
|
73
|
-
Generated on
|
|
104
|
+
Generated on Tue Dec 18 16:03:38 2018 by
|
|
74
105
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
75
106
|
0.9.16 (ruby-2.3.3).
|
|
76
107
|
</div>
|
data/doc/index.html
CHANGED
|
@@ -62,15 +62,46 @@
|
|
|
62
62
|
|
|
63
63
|
<p>A Ruby library for IoT (physical computing) projects with Raspberry Pi.</p>
|
|
64
64
|
|
|
65
|
-
<p>Why I made it
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
<p>Why I made it.</p>
|
|
66
|
+
|
|
67
|
+
<p>I'm a software developer and a maker. And I do love Raspberry Pi -
|
|
68
|
+
it's such a fun to do physical programming! But I love to program in
|
|
69
|
+
Ruby. So I tried to make a pragmatic set of useful IoT libraries for the
|
|
70
|
+
Ruby language for all who want to program for Raspberry Pi in Ruby.</p>
|
|
71
|
+
|
|
72
|
+
<p>To use this library you should do:</p>
|
|
73
|
+
<ol><li>
|
|
74
|
+
<p>Install the Ruby development version (to compile the extensions):</p>
|
|
75
|
+
</li></ol>
|
|
76
|
+
|
|
77
|
+
<p>sudo apt-get install ruby-dev</p>
|
|
78
|
+
<ol><li>
|
|
79
|
+
<p>Download and install the bcm2835-1.xx.tar.gz library:</p>
|
|
80
|
+
</li></ol>
|
|
81
|
+
|
|
82
|
+
<p>wget <a
|
|
83
|
+
href="http://www.airspayce.com/mikem/bcm2835/bcm2835-1.58.tar.gz">www.airspayce.com/mikem/bcm2835/bcm2835-1.58.tar.gz</a></p>
|
|
84
|
+
|
|
85
|
+
<p>tar zxvf bcm2835-1.xx.tar.gz</p>
|
|
86
|
+
|
|
87
|
+
<p>cd bcm2835-1.xx</p>
|
|
88
|
+
|
|
89
|
+
<p>./configure</p>
|
|
90
|
+
|
|
91
|
+
<p>make</p>
|
|
92
|
+
|
|
93
|
+
<p>sudo make check</p>
|
|
94
|
+
|
|
95
|
+
<p>sudo make install</p>
|
|
96
|
+
<ol><li>
|
|
97
|
+
<p>Install the latest version of gem:</p>
|
|
98
|
+
</li></ol>
|
|
99
|
+
|
|
100
|
+
<p>sudo gem install raspberry_pi_iot.gem</p>
|
|
70
101
|
</div></div>
|
|
71
102
|
|
|
72
103
|
<div id="footer">
|
|
73
|
-
Generated on
|
|
104
|
+
Generated on Tue Dec 18 16:03:38 2018 by
|
|
74
105
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
75
106
|
0.9.16 (ruby-2.3.3).
|
|
76
107
|
</div>
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
</div>
|
|
103
103
|
|
|
104
104
|
<div id="footer">
|
|
105
|
-
Generated on
|
|
105
|
+
Generated on Tue Dec 18 16:03:38 2018 by
|
|
106
106
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
107
107
|
0.9.16 (ruby-2.3.3).
|
|
108
108
|
</div>
|
data/lib/binary_effector.rb
CHANGED
data/lib/binary_receptor.rb
CHANGED
data/lib/bmx_sensor.rb
CHANGED
data/lib/digital_effector.rb
CHANGED
|
@@ -47,6 +47,23 @@ class DigitalEffector < Effector
|
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
def off?(pin=@pin)
|
|
50
|
-
!on(pin)
|
|
50
|
+
!on?(pin)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
private
|
|
54
|
+
def pin_number(pin)
|
|
55
|
+
if pin.class.name == 'Fixnum' # by number
|
|
56
|
+
pin
|
|
57
|
+
elsif @pins[pin] # by name
|
|
58
|
+
@pins[pin]
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def high?(pin=@pin)
|
|
63
|
+
RPi::GPIO.high? pin
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def low?(pin=@pin)
|
|
67
|
+
RPi::GPIO.low? pin
|
|
51
68
|
end
|
|
52
69
|
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
|
|
3
|
+
require 'minitest/autorun'
|
|
4
|
+
|
|
5
|
+
$LOAD_PATH << "../lib"
|
|
6
|
+
require 'bmx_sensor'
|
|
7
|
+
|
|
8
|
+
class RaspberryPiIoT_BMP280Test < MiniTest::Test
|
|
9
|
+
|
|
10
|
+
def setup
|
|
11
|
+
@bus = 1
|
|
12
|
+
@address = 0x76
|
|
13
|
+
@addr_s = sprintf("%02x", @address)
|
|
14
|
+
@sensor = BMP280.new
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def test_device_address
|
|
18
|
+
i2cd = `i2cdetect -y #{@bus}`
|
|
19
|
+
hex = i2cd.scan(/ (#{@addr_s})/).flatten
|
|
20
|
+
assert hex.size == 1 && hex[0] == @addr_s
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def test_temperature
|
|
24
|
+
c = @sensor.celsius
|
|
25
|
+
assert c > 15.0
|
|
26
|
+
|
|
27
|
+
r = @sensor.reaumur
|
|
28
|
+
assert r < c
|
|
29
|
+
|
|
30
|
+
f = @sensor.fahrenheit
|
|
31
|
+
assert f > c
|
|
32
|
+
|
|
33
|
+
k = @sensor.kelvin
|
|
34
|
+
assert k > f
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def test_pressure
|
|
38
|
+
m = @sensor.pressure(:mmHg)
|
|
39
|
+
assert m > 650.0
|
|
40
|
+
|
|
41
|
+
p = @sensor.pressure(:Pa)
|
|
42
|
+
assert p > m
|
|
43
|
+
|
|
44
|
+
a = @sensor.pressure(:atm)
|
|
45
|
+
assert a == p / 101325.0
|
|
46
|
+
|
|
47
|
+
b = @sensor.pressure(:bar)
|
|
48
|
+
assert b == p / 100000.0
|
|
49
|
+
|
|
50
|
+
t = @sensor.pressure(:Torr)
|
|
51
|
+
assert t == a / 760.0
|
|
52
|
+
end
|
|
53
|
+
end
|
data/test/test_bh1750.rb
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
|
|
3
|
+
require 'minitest/autorun'
|
|
4
|
+
|
|
5
|
+
$LOAD_PATH << "../lib"
|
|
6
|
+
require 'bh1750'
|
|
7
|
+
|
|
8
|
+
class RaspberryPiIoT_BH1750Test < MiniTest::Test
|
|
9
|
+
|
|
10
|
+
def setup
|
|
11
|
+
@bus = 1
|
|
12
|
+
@address = 0x23
|
|
13
|
+
@addr_s = sprintf("%02x", @address)
|
|
14
|
+
@sensor = BH1750.new(@address, @bus)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def test_i2c_bus
|
|
18
|
+
assert File.exists?(Bus::I2C.bus)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_device_address
|
|
22
|
+
i2cd = `i2cdetect -y #{@bus}`
|
|
23
|
+
hex = i2cd.scan(/ (#{@addr_s})/).flatten
|
|
24
|
+
assert hex.size == 1 && hex[0] == @addr_s
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def test_sensor_value
|
|
28
|
+
value = @sensor.lux
|
|
29
|
+
assert value > 0.0
|
|
30
|
+
end
|
|
31
|
+
end
|
data/test/test_button.rb
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
|
|
3
|
+
require 'minitest/autorun'
|
|
4
|
+
|
|
5
|
+
$LOAD_PATH << "../lib"
|
|
6
|
+
require "button"
|
|
7
|
+
|
|
8
|
+
class RaspberryPiIoT_ButtonTest < MiniTest::Test
|
|
9
|
+
|
|
10
|
+
def setup
|
|
11
|
+
@pin = 21
|
|
12
|
+
@button = Button.new(@pin)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def test_wait_for_press
|
|
16
|
+
printf "Waiting for press...\n"
|
|
17
|
+
@button.wait_for_press
|
|
18
|
+
assert @button.not_pressed?
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_wait_for_short_press
|
|
23
|
+
printf "Waiting for 1 short press...\n"
|
|
24
|
+
@button.wait_for_press
|
|
25
|
+
assert @button.single_press?
|
|
26
|
+
assert !@button.long_press?
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def test_wait_for_long_press
|
|
30
|
+
printf "Waiting for 1 long press...\n"
|
|
31
|
+
@button.wait_for_press
|
|
32
|
+
assert !@button.single_press?
|
|
33
|
+
assert @button.long_press?
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def test_wait_for_double_press
|
|
37
|
+
printf "Waiting for double press...\n", p
|
|
38
|
+
@button.wait_for_presses 2
|
|
39
|
+
assert @button.double_press?
|
|
40
|
+
end
|
|
41
|
+
end
|
data/test/test_dht11.rb
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
|
|
3
|
+
require 'minitest/autorun'
|
|
4
|
+
|
|
5
|
+
$LOAD_PATH << "../lib"
|
|
6
|
+
require "dht_sensor"
|
|
7
|
+
|
|
8
|
+
class RaspberryPiIoT_DHT11Test < MiniTest::Test
|
|
9
|
+
|
|
10
|
+
def setup
|
|
11
|
+
@pin = 23
|
|
12
|
+
@sensor = DHT11.new(@pin)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def test_temperature
|
|
16
|
+
c = @sensor.celsius
|
|
17
|
+
assert c > 15.0
|
|
18
|
+
|
|
19
|
+
r = @sensor.reaumur
|
|
20
|
+
assert r < c
|
|
21
|
+
|
|
22
|
+
f = @sensor.fahrenheit
|
|
23
|
+
assert f > c
|
|
24
|
+
|
|
25
|
+
k = @sensor.temperature(:kelvin)
|
|
26
|
+
assert k > f
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def test_humidity
|
|
30
|
+
h = @sensor.humidity
|
|
31
|
+
assert h > 10.0
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
|
|
3
|
+
require 'minitest/autorun'
|
|
4
|
+
|
|
5
|
+
$LOAD_PATH << "../lib"
|
|
6
|
+
require "ds18b20"
|
|
7
|
+
|
|
8
|
+
class RaspberryPiIoT_DS18B20Test < MiniTest::Test
|
|
9
|
+
|
|
10
|
+
def setup
|
|
11
|
+
@sensor = DS18B20.new
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def test_sensor_value
|
|
15
|
+
c = @sensor.celsius
|
|
16
|
+
assert c > 15.0
|
|
17
|
+
|
|
18
|
+
r = @sensor.reaumur
|
|
19
|
+
assert r < c
|
|
20
|
+
|
|
21
|
+
f = @sensor.fahrenheit
|
|
22
|
+
assert f > c
|
|
23
|
+
|
|
24
|
+
k = @sensor.kelvin
|
|
25
|
+
assert k > f
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
data/test/test_info.rb
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
|
|
3
|
+
require 'minitest/autorun'
|
|
4
|
+
|
|
5
|
+
$LOAD_PATH << "../lib"
|
|
6
|
+
require 'iot'
|
|
7
|
+
require 'raspberry_pi'
|
|
8
|
+
|
|
9
|
+
class RaspberryPiIoT_InfoTest < Minitest::Test
|
|
10
|
+
|
|
11
|
+
def test_model_name
|
|
12
|
+
assert_equal RaspberryPi.model_name()[0..11], "Raspberry Pi"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def test_info
|
|
16
|
+
assert_equal RaspberryPi.hardware_info['SoC'][0..2], "BCM"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
#IoT::Log.new.message "I", "Test logging."
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
|
data/test/test_led.rb
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
|
|
3
|
+
require 'minitest/autorun'
|
|
4
|
+
|
|
5
|
+
$LOAD_PATH << "../lib"
|
|
6
|
+
require 'led'
|
|
7
|
+
|
|
8
|
+
class RaspberryPiIoT_LedTest < Minitest::Test
|
|
9
|
+
def setup
|
|
10
|
+
@pin = 18
|
|
11
|
+
@color = :red
|
|
12
|
+
@led = LED.new(@pin)
|
|
13
|
+
@led.off
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def test_on
|
|
17
|
+
@led.on
|
|
18
|
+
assert @led.on?
|
|
19
|
+
assert !@led.off?
|
|
20
|
+
sleep 0.5
|
|
21
|
+
@led.off
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def test_on
|
|
25
|
+
@led.off
|
|
26
|
+
assert @led.off?
|
|
27
|
+
assert !@led.on?
|
|
28
|
+
sleep 0.5
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def test_blink
|
|
32
|
+
@led.blink(3)
|
|
33
|
+
@led.off
|
|
34
|
+
sleep 0.5
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def test_sos
|
|
38
|
+
3.times { @led.on_for(0.5); @led.off_for(0.25) }
|
|
39
|
+
sleep 0.5
|
|
40
|
+
3.times { @led.on_for(0.15); @led.off_for(0.25) }
|
|
41
|
+
sleep 0.5
|
|
42
|
+
3.times { @led.on_for(0.5); @led.off_for(0.25) }
|
|
43
|
+
sleep 1.5
|
|
44
|
+
@led.off
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
|
|
3
|
+
require 'minitest/autorun'
|
|
4
|
+
|
|
5
|
+
$LOAD_PATH << "../lib"
|
|
6
|
+
require 'led_rgb'
|
|
7
|
+
|
|
8
|
+
class RaspberryPiIoT_LedRgbTest < Minitest::Test
|
|
9
|
+
def setup
|
|
10
|
+
@red = 17
|
|
11
|
+
@green = 27
|
|
12
|
+
@blue = 22
|
|
13
|
+
@rgb = LED::RGB.new(@red, @green, @blue)
|
|
14
|
+
@time_on = 0.25
|
|
15
|
+
@time_off = 0.25
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def test_red
|
|
19
|
+
@rgb.on :red
|
|
20
|
+
sleep @time_on
|
|
21
|
+
@rgb.off
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def test_green
|
|
25
|
+
@rgb.on :green
|
|
26
|
+
sleep @time_on
|
|
27
|
+
@rgb.off
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def test_blue
|
|
31
|
+
@rgb.on :blue
|
|
32
|
+
sleep @time_on
|
|
33
|
+
@rgb.off
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def test_colors
|
|
37
|
+
1.times do |n|
|
|
38
|
+
[:red, :green, :blue, :yellow, :aqua].each do |color|
|
|
39
|
+
@rgb.on color
|
|
40
|
+
sleep @time_on
|
|
41
|
+
@rgb.off
|
|
42
|
+
sleep @time_off
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def test_blink_one
|
|
48
|
+
@rgb.blink :green, 4
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def test_blink_two
|
|
52
|
+
@rgb.blink [:red, :blue], 2
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def test_sos
|
|
56
|
+
@rgb.blink :red, 3, 0.25, 0.5
|
|
57
|
+
sleep 1
|
|
58
|
+
@rgb.blink :red, 3, 0.5, 0.5
|
|
59
|
+
sleep 1
|
|
60
|
+
@rgb.blink :red, 3, 0.25, 0.5
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
|
|
3
|
+
require 'minitest/autorun'
|
|
4
|
+
|
|
5
|
+
$LOAD_PATH << "../lib"
|
|
6
|
+
require 'max44009'
|
|
7
|
+
|
|
8
|
+
class RaspberryPiIoT_MAX44009Test < MiniTest::Test
|
|
9
|
+
|
|
10
|
+
def setup
|
|
11
|
+
@bus = 1
|
|
12
|
+
@address = 0x4a
|
|
13
|
+
@addr_s = sprintf("%02x", @address)
|
|
14
|
+
@sensor = MAX44009.new
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def test_i2c_bus
|
|
18
|
+
assert File.exists?(Bus::I2C.bus)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_device_address
|
|
22
|
+
i2cd = `i2cdetect -y #{@bus}`
|
|
23
|
+
hex = i2cd.scan(/ (#{@addr_s})/).flatten
|
|
24
|
+
assert hex.size == 1 && hex[0] == @addr_s
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def test_sensor_value
|
|
28
|
+
value = @sensor.lux
|
|
29
|
+
assert value > 0.0
|
|
30
|
+
end
|
|
31
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: raspberry_pi_iot
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mike Shock (Mikhail V. Shokhirev)
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-12-
|
|
11
|
+
date: 2018-12-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rpi_gpio
|
|
@@ -155,8 +155,10 @@ files:
|
|
|
155
155
|
- doc/method_list.html
|
|
156
156
|
- doc/top-level-namespace.html
|
|
157
157
|
- lib/bh1750.rb
|
|
158
|
+
- lib/binary_actuator.rb
|
|
158
159
|
- lib/binary_effector.rb
|
|
159
160
|
- lib/binary_receptor.rb
|
|
161
|
+
- lib/binary_sensor.rb
|
|
160
162
|
- lib/bmx_sensor.rb
|
|
161
163
|
- lib/bus.rb
|
|
162
164
|
- lib/button.rb
|
|
@@ -179,6 +181,15 @@ files:
|
|
|
179
181
|
- lib/receptor.rb
|
|
180
182
|
- lib/temperature_sensor.rb
|
|
181
183
|
- lib/thermal_sensor.rb
|
|
184
|
+
- test/standalone_test_bmp280.rb
|
|
185
|
+
- test/test_bh1750.rb
|
|
186
|
+
- test/test_button.rb
|
|
187
|
+
- test/test_dht11.rb
|
|
188
|
+
- test/test_ds18b20.rb
|
|
189
|
+
- test/test_info.rb
|
|
190
|
+
- test/test_led.rb
|
|
191
|
+
- test/test_led_rgb.rb
|
|
192
|
+
- test/test_max44009_gy49.rb
|
|
182
193
|
homepage: https://github.com/mike-shock/Ruby-Raspberry_Pi_IoT/
|
|
183
194
|
licenses:
|
|
184
195
|
- MIT
|