raspberry_pi_iot 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/Actuator.html +1 -1
- data/doc/BH1750.html +22 -16
- data/doc/BME280.html +5 -5
- data/doc/BMP280.html +5 -5
- data/doc/BMxSensor.html +29 -31
- data/doc/BinaryActuator.html +1 -1
- data/doc/BinaryEffector.html +1 -1
- data/doc/BinaryReceptor.html +1 -1
- data/doc/BinarySensor.html +1 -1
- 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 +2 -2
- data/doc/DigitalActuator.html +3 -3
- data/doc/DigitalEffector.html +2 -2
- data/doc/DigitalReceptor.html +1 -1
- data/doc/DigitalSensor.html +2 -2
- data/doc/Effector.html +1 -1
- data/doc/HCSR501.html +1 -1
- data/doc/HumitureSensor.html +1 -1
- data/doc/IoT.html +12 -2
- data/doc/LED.html +1 -1
- data/doc/MAX44009.html +1 -1
- data/doc/RaspberryPi.html +30 -22
- data/doc/Receptor.html +1 -1
- data/doc/Sensor.html +1 -1
- data/doc/TemperatureSensor.html +1 -1
- data/doc/_index.html +17 -1
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +80 -0
- data/doc/file_list.html +5 -0
- data/doc/index.html +18 -317
- data/doc/method_list.html +96 -48
- data/doc/top-level-namespace.html +1 -1
- data/lib/bh1750.rb +5 -2
- data/lib/bus.rb +25 -1
- data/lib/digital_actuator.rb +5 -0
- data/lib/digital_effector.rb +1 -5
- data/lib/digital_receptor.rb +0 -4
- data/lib/digital_sensor.rb +5 -0
- data/lib/ds18b20.rb +1 -1
- data/lib/iot.rb +15 -0
- data/lib/led_rgb.rb +1 -0
- data/lib/raspberry_pi.rb +11 -19
- data/lib/temperature_sensor.rb +1 -1
- data/lib/thermal_sensor.rb +1 -1
- metadata +5 -2
data/doc/method_list.html
CHANGED
@@ -85,6 +85,30 @@
|
|
85
85
|
|
86
86
|
|
87
87
|
<li class="even ">
|
88
|
+
<div class="item">
|
89
|
+
<span class='object_link'><a href="Bus/I2C.html#bus-class_method" title="Bus::I2C.bus (method)">bus</a></span>
|
90
|
+
<small>Bus::I2C</small>
|
91
|
+
</div>
|
92
|
+
</li>
|
93
|
+
|
94
|
+
|
95
|
+
<li class="odd ">
|
96
|
+
<div class="item">
|
97
|
+
<span class='object_link'><a href="Bus/I2C.html#bus_number-class_method" title="Bus::I2C.bus_number (method)">bus_number</a></span>
|
98
|
+
<small>Bus::I2C</small>
|
99
|
+
</div>
|
100
|
+
</li>
|
101
|
+
|
102
|
+
|
103
|
+
<li class="even ">
|
104
|
+
<div class="item">
|
105
|
+
<span class='object_link'><a href="Bus/I2C.html#bus_number=-class_method" title="Bus::I2C.bus_number= (method)">bus_number=</a></span>
|
106
|
+
<small>Bus::I2C</small>
|
107
|
+
</div>
|
108
|
+
</li>
|
109
|
+
|
110
|
+
|
111
|
+
<li class="odd ">
|
88
112
|
<div class="item">
|
89
113
|
<span class='object_link'><a href="TemperatureSensor.html#celsius-instance_method" title="TemperatureSensor#celsius (method)">#celsius</a></span>
|
90
114
|
<small>TemperatureSensor</small>
|
@@ -92,7 +116,23 @@
|
|
92
116
|
</li>
|
93
117
|
|
94
118
|
|
119
|
+
<li class="even ">
|
120
|
+
<div class="item">
|
121
|
+
<span class='object_link'><a href="Bus/I2C.html#device_address-instance_method" title="Bus::I2C#device_address (method)">#device_address</a></span>
|
122
|
+
<small>Bus::I2C</small>
|
123
|
+
</div>
|
124
|
+
</li>
|
125
|
+
|
126
|
+
|
95
127
|
<li class="odd ">
|
128
|
+
<div class="item">
|
129
|
+
<span class='object_link'><a href="Bus/I2C.html#device_address=-instance_method" title="Bus::I2C#device_address= (method)">#device_address=</a></span>
|
130
|
+
<small>Bus::I2C</small>
|
131
|
+
</div>
|
132
|
+
</li>
|
133
|
+
|
134
|
+
|
135
|
+
<li class="even ">
|
96
136
|
<div class="item">
|
97
137
|
<span class='object_link'><a href="Button.html#double_press%3F-instance_method" title="Button#double_press? (method)">#double_press?</a></span>
|
98
138
|
<small>Button</small>
|
@@ -100,7 +140,7 @@
|
|
100
140
|
</li>
|
101
141
|
|
102
142
|
|
103
|
-
<li class="
|
143
|
+
<li class="odd ">
|
104
144
|
<div class="item">
|
105
145
|
<span class='object_link'><a href="TemperatureSensor.html#fahrenheit-instance_method" title="TemperatureSensor#fahrenheit (method)">#fahrenheit</a></span>
|
106
146
|
<small>TemperatureSensor</small>
|
@@ -108,7 +148,7 @@
|
|
108
148
|
</li>
|
109
149
|
|
110
150
|
|
111
|
-
<li class="
|
151
|
+
<li class="even ">
|
112
152
|
<div class="item">
|
113
153
|
<span class='object_link'><a href="LED/RGB.html#green_off-instance_method" title="LED::RGB#green_off (method)">#green_off</a></span>
|
114
154
|
<small>LED::RGB</small>
|
@@ -116,7 +156,7 @@
|
|
116
156
|
</li>
|
117
157
|
|
118
158
|
|
119
|
-
<li class="
|
159
|
+
<li class="odd ">
|
120
160
|
<div class="item">
|
121
161
|
<span class='object_link'><a href="LED/RGB.html#green_on-instance_method" title="LED::RGB#green_on (method)">#green_on</a></span>
|
122
162
|
<small>LED::RGB</small>
|
@@ -124,7 +164,7 @@
|
|
124
164
|
</li>
|
125
165
|
|
126
166
|
|
127
|
-
<li class="
|
167
|
+
<li class="even ">
|
128
168
|
<div class="item">
|
129
169
|
<span class='object_link'><a href="BMxSensor.html#hPa-instance_method" title="BMxSensor#hPa (method)">#hPa</a></span>
|
130
170
|
<small>BMxSensor</small>
|
@@ -132,7 +172,7 @@
|
|
132
172
|
</li>
|
133
173
|
|
134
174
|
|
135
|
-
<li class="
|
175
|
+
<li class="odd ">
|
136
176
|
<div class="item">
|
137
177
|
<span class='object_link'><a href="RaspberryPi.html#hardware_info-class_method" title="RaspberryPi.hardware_info (method)">hardware_info</a></span>
|
138
178
|
<small>RaspberryPi</small>
|
@@ -140,7 +180,7 @@
|
|
140
180
|
</li>
|
141
181
|
|
142
182
|
|
143
|
-
<li class="
|
183
|
+
<li class="even ">
|
144
184
|
<div class="item">
|
145
185
|
<span class='object_link'><a href="BinaryReceptor.html#high%3F-instance_method" title="BinaryReceptor#high? (method)">#high?</a></span>
|
146
186
|
<small>BinaryReceptor</small>
|
@@ -148,7 +188,7 @@
|
|
148
188
|
</li>
|
149
189
|
|
150
190
|
|
151
|
-
<li class="
|
191
|
+
<li class="odd ">
|
152
192
|
<div class="item">
|
153
193
|
<span class='object_link'><a href="HumitureSensor.html#humidity-instance_method" title="HumitureSensor#humidity (method)">#humidity</a></span>
|
154
194
|
<small>HumitureSensor</small>
|
@@ -156,7 +196,7 @@
|
|
156
196
|
</li>
|
157
197
|
|
158
198
|
|
159
|
-
<li class="
|
199
|
+
<li class="even ">
|
160
200
|
<div class="item">
|
161
201
|
<span class='object_link'><a href="BH1750.html#initialize-instance_method" title="BH1750#initialize (method)">#initialize</a></span>
|
162
202
|
<small>BH1750</small>
|
@@ -164,7 +204,7 @@
|
|
164
204
|
</li>
|
165
205
|
|
166
206
|
|
167
|
-
<li class="
|
207
|
+
<li class="odd ">
|
168
208
|
<div class="item">
|
169
209
|
<span class='object_link'><a href="BinaryEffector.html#initialize-instance_method" title="BinaryEffector#initialize (method)">#initialize</a></span>
|
170
210
|
<small>BinaryEffector</small>
|
@@ -172,7 +212,7 @@
|
|
172
212
|
</li>
|
173
213
|
|
174
214
|
|
175
|
-
<li class="
|
215
|
+
<li class="even ">
|
176
216
|
<div class="item">
|
177
217
|
<span class='object_link'><a href="BinaryReceptor.html#initialize-instance_method" title="BinaryReceptor#initialize (method)">#initialize</a></span>
|
178
218
|
<small>BinaryReceptor</small>
|
@@ -180,7 +220,7 @@
|
|
180
220
|
</li>
|
181
221
|
|
182
222
|
|
183
|
-
<li class="
|
223
|
+
<li class="odd ">
|
184
224
|
<div class="item">
|
185
225
|
<span class='object_link'><a href="BMxSensor.html#initialize-instance_method" title="BMxSensor#initialize (method)">#initialize</a></span>
|
186
226
|
<small>BMxSensor</small>
|
@@ -188,7 +228,7 @@
|
|
188
228
|
</li>
|
189
229
|
|
190
230
|
|
191
|
-
<li class="
|
231
|
+
<li class="even ">
|
192
232
|
<div class="item">
|
193
233
|
<span class='object_link'><a href="BMP280.html#initialize-instance_method" title="BMP280#initialize (method)">#initialize</a></span>
|
194
234
|
<small>BMP280</small>
|
@@ -196,7 +236,7 @@
|
|
196
236
|
</li>
|
197
237
|
|
198
238
|
|
199
|
-
<li class="
|
239
|
+
<li class="odd ">
|
200
240
|
<div class="item">
|
201
241
|
<span class='object_link'><a href="BME280.html#initialize-instance_method" title="BME280#initialize (method)">#initialize</a></span>
|
202
242
|
<small>BME280</small>
|
@@ -204,7 +244,7 @@
|
|
204
244
|
</li>
|
205
245
|
|
206
246
|
|
207
|
-
<li class="
|
247
|
+
<li class="even ">
|
208
248
|
<div class="item">
|
209
249
|
<span class='object_link'><a href="Button.html#initialize-instance_method" title="Button#initialize (method)">#initialize</a></span>
|
210
250
|
<small>Button</small>
|
@@ -212,7 +252,7 @@
|
|
212
252
|
</li>
|
213
253
|
|
214
254
|
|
215
|
-
<li class="
|
255
|
+
<li class="odd ">
|
216
256
|
<div class="item">
|
217
257
|
<span class='object_link'><a href="DHTxxSensor.html#initialize-instance_method" title="DHTxxSensor#initialize (method)">#initialize</a></span>
|
218
258
|
<small>DHTxxSensor</small>
|
@@ -220,7 +260,7 @@
|
|
220
260
|
</li>
|
221
261
|
|
222
262
|
|
223
|
-
<li class="
|
263
|
+
<li class="even ">
|
224
264
|
<div class="item">
|
225
265
|
<span class='object_link'><a href="DHT11.html#initialize-instance_method" title="DHT11#initialize (method)">#initialize</a></span>
|
226
266
|
<small>DHT11</small>
|
@@ -228,7 +268,7 @@
|
|
228
268
|
</li>
|
229
269
|
|
230
270
|
|
231
|
-
<li class="
|
271
|
+
<li class="odd ">
|
232
272
|
<div class="item">
|
233
273
|
<span class='object_link'><a href="DHT22.html#initialize-instance_method" title="DHT22#initialize (method)">#initialize</a></span>
|
234
274
|
<small>DHT22</small>
|
@@ -236,7 +276,7 @@
|
|
236
276
|
</li>
|
237
277
|
|
238
278
|
|
239
|
-
<li class="
|
279
|
+
<li class="even ">
|
240
280
|
<div class="item">
|
241
281
|
<span class='object_link'><a href="DigitalEffector.html#initialize-instance_method" title="DigitalEffector#initialize (method)">#initialize</a></span>
|
242
282
|
<small>DigitalEffector</small>
|
@@ -244,7 +284,7 @@
|
|
244
284
|
</li>
|
245
285
|
|
246
286
|
|
247
|
-
<li class="
|
287
|
+
<li class="odd ">
|
248
288
|
<div class="item">
|
249
289
|
<span class='object_link'><a href="DS18B20.html#initialize-instance_method" title="DS18B20#initialize (method)">#initialize</a></span>
|
250
290
|
<small>DS18B20</small>
|
@@ -252,7 +292,7 @@
|
|
252
292
|
</li>
|
253
293
|
|
254
294
|
|
255
|
-
<li class="
|
295
|
+
<li class="even ">
|
256
296
|
<div class="item">
|
257
297
|
<span class='object_link'><a href="HumitureSensor.html#initialize-instance_method" title="HumitureSensor#initialize (method)">#initialize</a></span>
|
258
298
|
<small>HumitureSensor</small>
|
@@ -260,6 +300,14 @@
|
|
260
300
|
</li>
|
261
301
|
|
262
302
|
|
303
|
+
<li class="odd ">
|
304
|
+
<div class="item">
|
305
|
+
<span class='object_link'><a href="IoT/Log.html#initialize-instance_method" title="IoT::Log#initialize (method)">#initialize</a></span>
|
306
|
+
<small>IoT::Log</small>
|
307
|
+
</div>
|
308
|
+
</li>
|
309
|
+
|
310
|
+
|
263
311
|
<li class="even ">
|
264
312
|
<div class="item">
|
265
313
|
<span class='object_link'><a href="LED.html#initialize-instance_method" title="LED#initialize (method)">#initialize</a></span>
|
@@ -341,6 +389,14 @@
|
|
341
389
|
|
342
390
|
|
343
391
|
<li class="even ">
|
392
|
+
<div class="item">
|
393
|
+
<span class='object_link'><a href="IoT/Log.html#message-instance_method" title="IoT::Log#message (method)">#message</a></span>
|
394
|
+
<small>IoT::Log</small>
|
395
|
+
</div>
|
396
|
+
</li>
|
397
|
+
|
398
|
+
|
399
|
+
<li class="odd ">
|
344
400
|
<div class="item">
|
345
401
|
<span class='object_link'><a href="Effector.html#model_name-instance_method" title="Effector#model_name (method)">#model_name</a></span>
|
346
402
|
<small>Effector</small>
|
@@ -348,6 +404,14 @@
|
|
348
404
|
</li>
|
349
405
|
|
350
406
|
|
407
|
+
<li class="even ">
|
408
|
+
<div class="item">
|
409
|
+
<span class='object_link'><a href="RaspberryPi.html#model_name-class_method" title="RaspberryPi.model_name (method)">model_name</a></span>
|
410
|
+
<small>RaspberryPi</small>
|
411
|
+
</div>
|
412
|
+
</li>
|
413
|
+
|
414
|
+
|
351
415
|
<li class="odd ">
|
352
416
|
<div class="item">
|
353
417
|
<span class='object_link'><a href="Receptor.html#model_name-instance_method" title="Receptor#model_name (method)">#model_name</a></span>
|
@@ -485,14 +549,6 @@
|
|
485
549
|
|
486
550
|
|
487
551
|
<li class="even ">
|
488
|
-
<div class="item">
|
489
|
-
<span class='object_link'><a href="RaspberryPi.html#pi_model-class_method" title="RaspberryPi.pi_model (method)">pi_model</a></span>
|
490
|
-
<small>RaspberryPi</small>
|
491
|
-
</div>
|
492
|
-
</li>
|
493
|
-
|
494
|
-
|
495
|
-
<li class="odd ">
|
496
552
|
<div class="item">
|
497
553
|
<span class='object_link'><a href="Button.html#pressed%3F-instance_method" title="Button#pressed? (method)">#pressed?</a></span>
|
498
554
|
<small>Button</small>
|
@@ -500,7 +556,7 @@
|
|
500
556
|
</li>
|
501
557
|
|
502
558
|
|
503
|
-
<li class="
|
559
|
+
<li class="odd ">
|
504
560
|
<div class="item">
|
505
561
|
<span class='object_link'><a href="BMxSensor.html#pressure-instance_method" title="BMxSensor#pressure (method)">#pressure</a></span>
|
506
562
|
<small>BMxSensor</small>
|
@@ -508,7 +564,7 @@
|
|
508
564
|
</li>
|
509
565
|
|
510
566
|
|
511
|
-
<li class="
|
567
|
+
<li class="even ">
|
512
568
|
<div class="item">
|
513
569
|
<span class='object_link'><a href="BMxSensor.html#read_data-instance_method" title="BMxSensor#read_data (method)">#read_data</a></span>
|
514
570
|
<small>BMxSensor</small>
|
@@ -516,7 +572,7 @@
|
|
516
572
|
</li>
|
517
573
|
|
518
574
|
|
519
|
-
<li class="
|
575
|
+
<li class="odd ">
|
520
576
|
<div class="item">
|
521
577
|
<span class='object_link'><a href="DHTxxSensor.html#read_data-instance_method" title="DHTxxSensor#read_data (method)">#read_data</a></span>
|
522
578
|
<small>DHTxxSensor</small>
|
@@ -524,7 +580,7 @@
|
|
524
580
|
</li>
|
525
581
|
|
526
582
|
|
527
|
-
<li class="
|
583
|
+
<li class="even ">
|
528
584
|
<div class="item">
|
529
585
|
<span class='object_link'><a href="DS18B20.html#read_data-instance_method" title="DS18B20#read_data (method)">#read_data</a></span>
|
530
586
|
<small>DS18B20</small>
|
@@ -532,7 +588,7 @@
|
|
532
588
|
</li>
|
533
589
|
|
534
590
|
|
535
|
-
<li class="
|
591
|
+
<li class="odd ">
|
536
592
|
<div class="item">
|
537
593
|
<span class='object_link'><a href="HumitureSensor.html#read_data-instance_method" title="HumitureSensor#read_data (method)">#read_data</a></span>
|
538
594
|
<small>HumitureSensor</small>
|
@@ -540,7 +596,7 @@
|
|
540
596
|
</li>
|
541
597
|
|
542
598
|
|
543
|
-
<li class="
|
599
|
+
<li class="even ">
|
544
600
|
<div class="item">
|
545
601
|
<span class='object_link'><a href="TemperatureSensor.html#read_data-instance_method" title="TemperatureSensor#read_data (method)">#read_data</a></span>
|
546
602
|
<small>TemperatureSensor</small>
|
@@ -548,7 +604,7 @@
|
|
548
604
|
</li>
|
549
605
|
|
550
606
|
|
551
|
-
<li class="
|
607
|
+
<li class="odd ">
|
552
608
|
<div class="item">
|
553
609
|
<span class='object_link'><a href="RaspberryPi/ThermalSensor.html#read_data-instance_method" title="RaspberryPi::ThermalSensor#read_data (method)">#read_data</a></span>
|
554
610
|
<small>RaspberryPi::ThermalSensor</small>
|
@@ -556,7 +612,7 @@
|
|
556
612
|
</li>
|
557
613
|
|
558
614
|
|
559
|
-
<li class="
|
615
|
+
<li class="even ">
|
560
616
|
<div class="item">
|
561
617
|
<span class='object_link'><a href="BH1750.html#read_sensor-instance_method" title="BH1750#read_sensor (method)">#read_sensor</a></span>
|
562
618
|
<small>BH1750</small>
|
@@ -564,7 +620,7 @@
|
|
564
620
|
</li>
|
565
621
|
|
566
622
|
|
567
|
-
<li class="
|
623
|
+
<li class="odd ">
|
568
624
|
<div class="item">
|
569
625
|
<span class='object_link'><a href="MAX44009.html#read_sensor-instance_method" title="MAX44009#read_sensor (method)">#read_sensor</a></span>
|
570
626
|
<small>MAX44009</small>
|
@@ -572,7 +628,7 @@
|
|
572
628
|
</li>
|
573
629
|
|
574
630
|
|
575
|
-
<li class="
|
631
|
+
<li class="even ">
|
576
632
|
<div class="item">
|
577
633
|
<span class='object_link'><a href="TemperatureSensor.html#reaumur-instance_method" title="TemperatureSensor#reaumur (method)">#reaumur</a></span>
|
578
634
|
<small>TemperatureSensor</small>
|
@@ -580,7 +636,7 @@
|
|
580
636
|
</li>
|
581
637
|
|
582
638
|
|
583
|
-
<li class="
|
639
|
+
<li class="odd ">
|
584
640
|
<div class="item">
|
585
641
|
<span class='object_link'><a href="LED/RGB.html#red_off-instance_method" title="LED::RGB#red_off (method)">#red_off</a></span>
|
586
642
|
<small>LED::RGB</small>
|
@@ -588,7 +644,7 @@
|
|
588
644
|
</li>
|
589
645
|
|
590
646
|
|
591
|
-
<li class="
|
647
|
+
<li class="even ">
|
592
648
|
<div class="item">
|
593
649
|
<span class='object_link'><a href="LED/RGB.html#red_on-instance_method" title="LED::RGB#red_on (method)">#red_on</a></span>
|
594
650
|
<small>LED::RGB</small>
|
@@ -596,14 +652,6 @@
|
|
596
652
|
</li>
|
597
653
|
|
598
654
|
|
599
|
-
<li class="even ">
|
600
|
-
<div class="item">
|
601
|
-
<span class='object_link'><a href="Bus/I2C.html#set_bus-class_method" title="Bus::I2C.set_bus (method)">set_bus</a></span>
|
602
|
-
<small>Bus::I2C</small>
|
603
|
-
</div>
|
604
|
-
</li>
|
605
|
-
|
606
|
-
|
607
655
|
<li class="odd ">
|
608
656
|
<div class="item">
|
609
657
|
<span class='object_link'><a href="Button.html#single_press%3F-instance_method" title="Button#single_press? (method)">#single_press?</a></span>
|
@@ -102,7 +102,7 @@
|
|
102
102
|
</div>
|
103
103
|
|
104
104
|
<div id="footer">
|
105
|
-
Generated on
|
105
|
+
Generated on Mon Dec 17 17:41:39 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/bh1750.rb
CHANGED
@@ -14,9 +14,12 @@ class BH1750
|
|
14
14
|
ONE_TIME_HIGH_RES_MODE_1 = 0x20 # Measure with resolution 1.0 lx, POWER DOWN after measuring
|
15
15
|
ONE_TIME_HIGH_RES_MODE_2 = 0x21 # Measure with resolution 0.5 lx, POWER DOWN after measuring
|
16
16
|
|
17
|
-
def initialize(
|
17
|
+
def initialize(device_address=DEVICE, bus_number=1)
|
18
18
|
@sensor_name = 'BH1750'
|
19
|
-
|
19
|
+
Bus::I2C.bus_number = bus_number
|
20
|
+
@device_address = device_address
|
21
|
+
|
22
|
+
@i2c_bus = Bus::I2C.bus
|
20
23
|
@device = I2CDevice.new(address: DEVICE, driver: I2CDevice::Driver::I2CDev.new(@i2c_bus))
|
21
24
|
@resolution = ONE_TIME_HIGH_RES_MODE_1
|
22
25
|
@length = 2
|
data/lib/bus.rb
CHANGED
@@ -14,10 +14,34 @@ module Bus
|
|
14
14
|
|
15
15
|
# I2C interface to devices
|
16
16
|
class I2C
|
17
|
+
@@bus_number = 1
|
17
18
|
@@i2c_bus = '/dev/i2c-1'
|
18
|
-
|
19
|
+
@device_address = 0x00
|
20
|
+
|
21
|
+
# Define the I2C bus number: 0 | 1 (default)
|
22
|
+
def self.bus_number=(bus=1)
|
23
|
+
@@bus_number = bus
|
19
24
|
@@i2c_bus = "/dev/i2c-#{bus}"
|
20
25
|
end
|
26
|
+
|
27
|
+
def self.bus_number
|
28
|
+
@@bus_number
|
29
|
+
end
|
30
|
+
|
31
|
+
# Return the I2C bus file
|
32
|
+
def self.bus
|
33
|
+
@@i2c_bus
|
34
|
+
end
|
35
|
+
|
36
|
+
# Define the device address
|
37
|
+
def device_address=(address)
|
38
|
+
@device_address = address
|
39
|
+
end
|
40
|
+
|
41
|
+
# Return the device address
|
42
|
+
def device_address
|
43
|
+
@device_address
|
44
|
+
end
|
21
45
|
end
|
22
46
|
|
23
47
|
# SPI interface to devices
|
data/lib/digital_effector.rb
CHANGED
data/lib/digital_receptor.rb
CHANGED
data/lib/ds18b20.rb
CHANGED
data/lib/iot.rb
CHANGED
@@ -1,4 +1,19 @@
|
|
1
1
|
# IoT - Internet of Things classes and modules
|
2
2
|
module IoT
|
3
3
|
|
4
|
+
# Logging events and actions
|
5
|
+
class Log
|
6
|
+
@file_name = nil
|
7
|
+
|
8
|
+
def initialize(file_name='/tmp/iot.log')
|
9
|
+
@file_name = file_name
|
10
|
+
end
|
11
|
+
|
12
|
+
# Message types: I = Info, W = Warning, E = Error, F = Fatal error
|
13
|
+
def message(type='I', text='OK')
|
14
|
+
File.open(@file_name, 'w+') do |log|
|
15
|
+
log.printf "%s %s %s\n", Time.now.strftime("%Y%m%d %H%M%S"), type, text
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
4
19
|
end
|
data/lib/led_rgb.rb
CHANGED
data/lib/raspberry_pi.rb
CHANGED
@@ -1,27 +1,19 @@
|
|
1
1
|
module RaspberryPi
|
2
|
-
# https://www.raspberrypi-spy.co.uk/2012/09/checking-your-raspberry-pi-board-version/
|
3
2
|
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
info
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
3
|
+
# Return the model name
|
4
|
+
# https://www.raspberrypi-spy.co.uk/2012/09/checking-your-raspberry-pi-board-version/
|
5
|
+
def self.model_name(source='proc')
|
6
|
+
info = if source == 'proc'
|
7
|
+
`cat /proc/device-tree/model`
|
8
|
+
elsif
|
9
|
+
`pinout | grep -Eo "Pi Model[^|]+"`
|
10
|
+
else
|
11
|
+
'N/A'
|
12
|
+
end
|
12
13
|
info.strip
|
13
14
|
end
|
14
15
|
|
15
|
-
#
|
16
|
-
# SoC : BCM2837
|
17
|
-
# RAM : 1024Mb
|
18
|
-
# Storage : MicroSD
|
19
|
-
# USB ports : 4 (excluding power)
|
20
|
-
# Ethernet ports : 1
|
21
|
-
# Wi-fi : True
|
22
|
-
# Bluetooth : True
|
23
|
-
# Camera ports (CSI) : 1
|
24
|
-
# Display ports (DSI): 1
|
16
|
+
# Return hardware info as a hash
|
25
17
|
def self.hardware_info
|
26
18
|
info = {}
|
27
19
|
lines = ` pinout | grep ': '`
|
data/lib/temperature_sensor.rb
CHANGED
data/lib/thermal_sensor.rb
CHANGED
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.7
|
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-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rpi_gpio
|
@@ -148,6 +148,7 @@ files:
|
|
148
148
|
- doc/TemperatureSensor.html
|
149
149
|
- doc/_index.html
|
150
150
|
- doc/class_list.html
|
151
|
+
- doc/file.README.html
|
151
152
|
- doc/file_list.html
|
152
153
|
- doc/frames.html
|
153
154
|
- doc/index.html
|
@@ -160,8 +161,10 @@ files:
|
|
160
161
|
- lib/bus.rb
|
161
162
|
- lib/button.rb
|
162
163
|
- lib/dht_sensor.rb
|
164
|
+
- lib/digital_actuator.rb
|
163
165
|
- lib/digital_effector.rb
|
164
166
|
- lib/digital_receptor.rb
|
167
|
+
- lib/digital_sensor.rb
|
165
168
|
- lib/ds18b20.rb
|
166
169
|
- lib/effector.rb
|
167
170
|
- lib/hcsr501.rb
|