raspberry_pi_iot 0.0.12 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/doc/IoT.html +6 -4
  3. data/doc/RaspberryPiIoT.html +16 -10
  4. data/doc/_index.html +197 -21
  5. data/doc/class_list.html +1 -1
  6. data/doc/file.LICENSE.html +1 -1
  7. data/doc/file.README.html +15 -6
  8. data/doc/index.html +15 -6
  9. data/doc/method_list.html +590 -30
  10. data/doc/top-level-namespace.html +2 -2
  11. data/lib/iot/bh1750.rb +6 -4
  12. data/lib/iot/receptor.rb +6 -0
  13. data/lib/raspberry_pi.rb +1 -1
  14. data/lib/raspberry_pi_iot/version.rb +1 -1
  15. data/test/test.sh +5 -0
  16. data/test/test.txt +52 -169
  17. data/test/test_bh1750.rb +5 -0
  18. data/test/test_ky008.rb +41 -0
  19. metadata +2 -29
  20. data/doc/Actuator.html +0 -145
  21. data/doc/BH1750.html +0 -541
  22. data/doc/BME280.html +0 -276
  23. data/doc/BMP280.html +0 -276
  24. data/doc/BMxSensor.html +0 -557
  25. data/doc/BinaryActuator.html +0 -177
  26. data/doc/BinaryEffector.html +0 -246
  27. data/doc/BinaryReceptor.html +0 -387
  28. data/doc/BinarySensor.html +0 -168
  29. data/doc/Bus.html +0 -126
  30. data/doc/Button.html +0 -1276
  31. data/doc/DHT11.html +0 -287
  32. data/doc/DHT22.html +0 -287
  33. data/doc/DHTxxSensor.html +0 -361
  34. data/doc/DS18B20.html +0 -339
  35. data/doc/DigitalActuator.html +0 -164
  36. data/doc/DigitalEffector.html +0 -624
  37. data/doc/DigitalReceptor.html +0 -242
  38. data/doc/DigitalSensor.html +0 -162
  39. data/doc/Effector.html +0 -257
  40. data/doc/HCSR501.html +0 -172
  41. data/doc/HumitureSensor.html +0 -453
  42. data/doc/LED.html +0 -836
  43. data/doc/MAX44009.html +0 -830
  44. data/doc/RaspberryPi.html +0 -544
  45. data/doc/Receptor.html +0 -257
  46. data/doc/Sensor.html +0 -145
  47. data/doc/TemperatureSensor.html +0 -644
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require 'minitest/autorun'
4
+
5
+ $LOAD_PATH << "../lib" unless ARGV[0] == "gem"
6
+ require 'iot/binary_effector'
7
+
8
+ laser = IoT::BinaryEffector.new(4)
9
+
10
+ class RaspberryPiIoT_LedTest < Minitest::Test
11
+ def setup
12
+ @pin = 26
13
+ @laser = IoT::BinaryEffector.new(@pin)
14
+ @laser.off
15
+ end
16
+
17
+ def test_on_off
18
+ @laser.on
19
+ assert @laser.on?
20
+ assert !@laser.off?
21
+ sleep 3
22
+ @laser.off
23
+ end
24
+
25
+ def test_off_on
26
+ @laser.off
27
+ assert @laser.off?
28
+ assert !@laser.on?
29
+ sleep 1
30
+ end
31
+
32
+ def test_sos
33
+ 3.times { @laser.on; sleep(0.25); @laser.off; sleep(0.25) }
34
+ sleep 1
35
+ 3.times { @laser.on; sleep(0.5); @laser.off; sleep(0.25) }
36
+ sleep 1
37
+ 3.times { @laser.on; sleep(0.25); @laser.off; sleep(0.25) }
38
+ sleep 1.5
39
+ @laser.off
40
+ end
41
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raspberry_pi_iot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Shock (Mikhail V. Shokhirev)
@@ -173,36 +173,8 @@ executables: []
173
173
  extensions: []
174
174
  extra_rdoc_files: []
175
175
  files:
176
- - doc/Actuator.html
177
- - doc/BH1750.html
178
- - doc/BME280.html
179
- - doc/BMP280.html
180
- - doc/BMxSensor.html
181
- - doc/BinaryActuator.html
182
- - doc/BinaryEffector.html
183
- - doc/BinaryReceptor.html
184
- - doc/BinarySensor.html
185
- - doc/Bus.html
186
- - doc/Button.html
187
- - doc/DHT11.html
188
- - doc/DHT22.html
189
- - doc/DHTxxSensor.html
190
- - doc/DS18B20.html
191
- - doc/DigitalActuator.html
192
- - doc/DigitalEffector.html
193
- - doc/DigitalReceptor.html
194
- - doc/DigitalSensor.html
195
- - doc/Effector.html
196
- - doc/HCSR501.html
197
- - doc/HumitureSensor.html
198
176
  - doc/IoT.html
199
- - doc/LED.html
200
- - doc/MAX44009.html
201
- - doc/RaspberryPi.html
202
177
  - doc/RaspberryPiIoT.html
203
- - doc/Receptor.html
204
- - doc/Sensor.html
205
- - doc/TemperatureSensor.html
206
178
  - doc/_index.html
207
179
  - doc/class_list.html
208
180
  - doc/file.LICENSE.html
@@ -254,6 +226,7 @@ files:
254
226
  - test/test_ds18b20.rb
255
227
  - test/test_helper.rb
256
228
  - test/test_info.rb
229
+ - test/test_ky008.rb
257
230
  - test/test_led.rb
258
231
  - test/test_led_rgb.rb
259
232
  - test/test_max44009_gy49.rb
@@ -1,145 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>
7
- Class: Actuator
8
-
9
- &mdash; Documentation by YARD 0.9.16
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
-
15
- <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
-
17
- <script type="text/javascript" charset="utf-8">
18
- pathId = "Actuator";
19
- relpath = '';
20
- </script>
21
-
22
-
23
- <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
-
25
- <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
-
27
-
28
- </head>
29
- <body>
30
- <div class="nav_wrap">
31
- <iframe id="nav" src="class_list.html?1"></iframe>
32
- <div id="resizer"></div>
33
- </div>
34
-
35
- <div id="main" tabindex="-1">
36
- <div id="header">
37
- <div id="menu">
38
-
39
- <a href="_index.html">Index (A)</a> &raquo;
40
-
41
-
42
- <span class="title">Actuator</span>
43
-
44
- </div>
45
-
46
- <div id="search">
47
-
48
- <a class="full_list_link" id="class_list_link"
49
- href="class_list.html">
50
-
51
- <svg width="24" height="24">
52
- <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
- <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
- <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
- </svg>
56
- </a>
57
-
58
- </div>
59
- <div class="clear"></div>
60
- </div>
61
-
62
- <div id="content"><h1>Class: Actuator
63
-
64
-
65
-
66
- </h1>
67
- <div class="box_info">
68
-
69
- <dl>
70
- <dt>Inherits:</dt>
71
- <dd>
72
- <span class="inheritName"><span class='object_link'><a href="Effector.html" title="Effector (class)">Effector</a></span></span>
73
-
74
- <ul class="fullTree">
75
- <li>Object</li>
76
-
77
- <li class="next"><span class='object_link'><a href="Effector.html" title="Effector (class)">Effector</a></span></li>
78
-
79
- <li class="next">Actuator</li>
80
-
81
- </ul>
82
- <a href="#" class="inheritanceTree">show all</a>
83
-
84
- </dd>
85
- </dl>
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
- <dl>
98
- <dt>Defined in:</dt>
99
- <dd>lib/effector.rb</dd>
100
- </dl>
101
-
102
- </div>
103
-
104
- <h2>Overview</h2><div class="docstring">
105
- <div class="discussion">
106
-
107
- <p>Actuator - a synonym for Effector</p>
108
-
109
-
110
- </div>
111
- </div>
112
- <div class="tags">
113
-
114
-
115
- </div>
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
-
126
-
127
-
128
-
129
- <h2>Method Summary</h2>
130
-
131
- <h3 class="inherited">Methods inherited from <span class='object_link'><a href="Effector.html" title="Effector (class)">Effector</a></span></h3>
132
- <p class="inherited"><span class='object_link'><a href="Effector.html#model_name-instance_method" title="Effector#model_name (method)">#model_name</a></span>, <span class='object_link'><a href="Effector.html#name-instance_method" title="Effector#name (method)">#name</a></span></p>
133
-
134
-
135
- </div>
136
-
137
- <div id="footer">
138
- Generated on Wed Dec 26 18:10:11 2018 by
139
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
140
- 0.9.16 (ruby-2.3.3).
141
- </div>
142
-
143
- </div>
144
- </body>
145
- </html>
@@ -1,541 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>
7
- Class: BH1750
8
-
9
- &mdash; Documentation by YARD 0.9.16
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
-
15
- <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
-
17
- <script type="text/javascript" charset="utf-8">
18
- pathId = "BH1750";
19
- relpath = '';
20
- </script>
21
-
22
-
23
- <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
-
25
- <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
-
27
-
28
- </head>
29
- <body>
30
- <div class="nav_wrap">
31
- <iframe id="nav" src="class_list.html?1"></iframe>
32
- <div id="resizer"></div>
33
- </div>
34
-
35
- <div id="main" tabindex="-1">
36
- <div id="header">
37
- <div id="menu">
38
-
39
- <a href="_index.html">Index (B)</a> &raquo;
40
-
41
-
42
- <span class="title">BH1750</span>
43
-
44
- </div>
45
-
46
- <div id="search">
47
-
48
- <a class="full_list_link" id="class_list_link"
49
- href="class_list.html">
50
-
51
- <svg width="24" height="24">
52
- <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
- <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
- <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
- </svg>
56
- </a>
57
-
58
- </div>
59
- <div class="clear"></div>
60
- </div>
61
-
62
- <div id="content"><h1>Class: BH1750
63
-
64
-
65
-
66
- </h1>
67
- <div class="box_info">
68
-
69
- <dl>
70
- <dt>Inherits:</dt>
71
- <dd>
72
- <span class="inheritName">Object</span>
73
-
74
- <ul class="fullTree">
75
- <li>Object</li>
76
-
77
- <li class="next">BH1750</li>
78
-
79
- </ul>
80
- <a href="#" class="inheritanceTree">show all</a>
81
-
82
- </dd>
83
- </dl>
84
-
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
- <dl>
96
- <dt>Defined in:</dt>
97
- <dd>lib/bh1750.rb</dd>
98
- </dl>
99
-
100
- </div>
101
-
102
- <h2>Overview</h2><div class="docstring">
103
- <div class="discussion">
104
-
105
- <p>BH1750 - ambient light sensor</p>
106
-
107
-
108
- </div>
109
- </div>
110
- <div class="tags">
111
-
112
-
113
- </div>
114
-
115
- <h2>
116
- Constant Summary
117
- <small><a href="#" class="constants_summary_toggle">collapse</a></small>
118
- </h2>
119
-
120
- <dl class="constants">
121
-
122
- <dt id="DEVICE-constant" class="">DEVICE =
123
- <div class="docstring">
124
- <div class="discussion">
125
-
126
- <p>I2C sensor address</p>
127
-
128
-
129
- </div>
130
- </div>
131
- <div class="tags">
132
-
133
-
134
- </div>
135
- </dt>
136
- <dd><pre class="code"><span class='int'>0x23</span></pre></dd>
137
-
138
- <dt id="POWER_DOWN-constant" class="">POWER_DOWN =
139
- <div class="docstring">
140
- <div class="discussion">
141
-
142
- <p>off state</p>
143
-
144
-
145
- </div>
146
- </div>
147
- <div class="tags">
148
-
149
-
150
- </div>
151
- </dt>
152
- <dd><pre class="code"><span class='int'>0x00</span></pre></dd>
153
-
154
- <dt id="POWER_ON-constant" class="">POWER_ON =
155
- <div class="docstring">
156
- <div class="discussion">
157
-
158
- <p>on state</p>
159
-
160
-
161
- </div>
162
- </div>
163
- <div class="tags">
164
-
165
-
166
- </div>
167
- </dt>
168
- <dd><pre class="code"><span class='int'>0x01</span></pre></dd>
169
-
170
- <dt id="RESET-constant" class="">RESET =
171
- <div class="docstring">
172
- <div class="discussion">
173
-
174
- <p>reset state: POWER_DOWN = 0x00</p>
175
-
176
-
177
- </div>
178
- </div>
179
- <div class="tags">
180
-
181
-
182
- </div>
183
- </dt>
184
- <dd><pre class="code"><span class='int'>0x07</span></pre></dd>
185
-
186
- <dt id="CONTINUOUS_LOW_RES_MODE-constant" class="">CONTINUOUS_LOW_RES_MODE =
187
- <div class="docstring">
188
- <div class="discussion">
189
-
190
- <p>Measure with resolution 4.0 lx and timing ~16 ms</p>
191
-
192
-
193
- </div>
194
- </div>
195
- <div class="tags">
196
-
197
-
198
- </div>
199
- </dt>
200
- <dd><pre class="code"><span class='int'>0x13</span></pre></dd>
201
-
202
- <dt id="CONTINUOUS_HIGH_RES_MODE_1-constant" class="">CONTINUOUS_HIGH_RES_MODE_1 =
203
- <div class="docstring">
204
- <div class="discussion">
205
-
206
- <p>Measure with resolution 1.0 lx and timing ~120 ms</p>
207
-
208
-
209
- </div>
210
- </div>
211
- <div class="tags">
212
-
213
-
214
- </div>
215
- </dt>
216
- <dd><pre class="code"><span class='int'>0x10</span></pre></dd>
217
-
218
- <dt id="CONTINUOUS_HIGH_RES_MODE_2-constant" class="">CONTINUOUS_HIGH_RES_MODE_2 =
219
- <div class="docstring">
220
- <div class="discussion">
221
-
222
- <p>Measure with resolution 0.5 lx and timing ~120 ms</p>
223
-
224
-
225
- </div>
226
- </div>
227
- <div class="tags">
228
-
229
-
230
- </div>
231
- </dt>
232
- <dd><pre class="code"><span class='int'>0x11</span></pre></dd>
233
-
234
- <dt id="ONE_TIME_LOW_RES_MODE-constant" class="">ONE_TIME_LOW_RES_MODE =
235
- <div class="docstring">
236
- <div class="discussion">
237
-
238
- <p>Measure with resolution 4.0 lx, POWER DOWN after measuring</p>
239
-
240
-
241
- </div>
242
- </div>
243
- <div class="tags">
244
-
245
-
246
- </div>
247
- </dt>
248
- <dd><pre class="code"><span class='int'>0x23</span></pre></dd>
249
-
250
- <dt id="ONE_TIME_HIGH_RES_MODE_1-constant" class="">ONE_TIME_HIGH_RES_MODE_1 =
251
- <div class="docstring">
252
- <div class="discussion">
253
-
254
- <p>Measure with resolution 1.0 lx, POWER DOWN after measuring</p>
255
-
256
-
257
- </div>
258
- </div>
259
- <div class="tags">
260
-
261
-
262
- </div>
263
- </dt>
264
- <dd><pre class="code"><span class='int'>0x20</span></pre></dd>
265
-
266
- <dt id="ONE_TIME_HIGH_RES_MODE_2-constant" class="">ONE_TIME_HIGH_RES_MODE_2 =
267
- <div class="docstring">
268
- <div class="discussion">
269
-
270
- <p>Measure with resolution 0.5 lx, POWER DOWN after measuring</p>
271
-
272
-
273
- </div>
274
- </div>
275
- <div class="tags">
276
-
277
-
278
- </div>
279
- </dt>
280
- <dd><pre class="code"><span class='int'>0x21</span></pre></dd>
281
-
282
- </dl>
283
-
284
-
285
-
286
-
287
-
288
-
289
-
290
-
291
-
292
- <h2>
293
- Instance Method Summary
294
- <small><a href="#" class="summary_toggle">collapse</a></small>
295
- </h2>
296
-
297
- <ul class="summary">
298
-
299
- <li class="public ">
300
- <span class="summary_signature">
301
-
302
- <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(device_address = DEVICE, bus_number = 1) &#x21d2; BH1750 </a>
303
-
304
-
305
-
306
- </span>
307
-
308
-
309
- <span class="note title constructor">constructor</span>
310
-
311
-
312
-
313
-
314
-
315
-
316
-
317
-
318
- <span class="summary_desc"><div class='inline'>
319
- <p>A new instance of BH1750.</p>
320
- </div></span>
321
-
322
- </li>
323
-
324
-
325
- <li class="public ">
326
- <span class="summary_signature">
327
-
328
- <a href="#lux-instance_method" title="#lux (instance method)">#<strong>lux</strong> &#x21d2; Object </a>
329
-
330
-
331
-
332
- </span>
333
-
334
-
335
-
336
-
337
-
338
-
339
-
340
-
341
-
342
- <span class="summary_desc"><div class='inline'>
343
- <p>Return value in Lux.</p>
344
- </div></span>
345
-
346
- </li>
347
-
348
-
349
- <li class="public ">
350
- <span class="summary_signature">
351
-
352
- <a href="#read_sensor-instance_method" title="#read_sensor (instance method)">#<strong>read_sensor</strong> &#x21d2; Object </a>
353
-
354
-
355
-
356
- </span>
357
-
358
-
359
-
360
-
361
-
362
-
363
-
364
-
365
-
366
- <span class="summary_desc"><div class='inline'>
367
- <p>Read raw data from sensor and convert it to numeric.</p>
368
- </div></span>
369
-
370
- </li>
371
-
372
-
373
- </ul>
374
-
375
-
376
- <div id="constructor_details" class="method_details_list">
377
- <h2>Constructor Details</h2>
378
-
379
- <div class="method_details first">
380
- <h3 class="signature first" id="initialize-instance_method">
381
-
382
- #<strong>initialize</strong>(device_address = DEVICE, bus_number = 1) &#x21d2; <tt><span class='object_link'><a href="" title="BH1750 (class)">BH1750</a></span></tt>
383
-
384
-
385
-
386
-
387
-
388
- </h3><div class="docstring">
389
- <div class="discussion">
390
-
391
- <p>Returns a new instance of BH1750</p>
392
-
393
-
394
- </div>
395
- </div>
396
- <div class="tags">
397
-
398
-
399
- </div><table class="source_code">
400
- <tr>
401
- <td>
402
- <pre class="lines">
403
-
404
-
405
- 17
406
- 18
407
- 19
408
- 20
409
- 21
410
- 22
411
- 23
412
- 24
413
- 25
414
- 26
415
- 27</pre>
416
- </td>
417
- <td>
418
- <pre class="code"><span class="info file"># File 'lib/bh1750.rb', line 17</span>
419
-
420
- <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_device_address'>device_address</span><span class='op'>=</span><span class='const'>DEVICE</span><span class='comma'>,</span> <span class='id identifier rubyid_bus_number'>bus_number</span><span class='op'>=</span><span class='int'>1</span><span class='rparen'>)</span>
421
- <span class='ivar'>@sensor_name</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>BH1750</span><span class='tstring_end'>&#39;</span></span>
422
- <span class='const'><span class='object_link'><a href="Bus.html" title="Bus (module)">Bus</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Bus/I2C.html" title="Bus::I2C (class)">I2C</a></span></span><span class='period'>.</span><span class='id identifier rubyid_bus_number'><span class='object_link'><a href="Bus/I2C.html#bus_number-class_method" title="Bus::I2C.bus_number (method)">bus_number</a></span></span> <span class='op'>=</span> <span class='id identifier rubyid_bus_number'>bus_number</span>
423
- <span class='ivar'>@device_address</span> <span class='op'>=</span> <span class='id identifier rubyid_device_address'>device_address</span>
424
-
425
- <span class='ivar'>@i2c_bus</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Bus.html" title="Bus (module)">Bus</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Bus/I2C.html" title="Bus::I2C (class)">I2C</a></span></span><span class='period'>.</span><span class='id identifier rubyid_bus'><span class='object_link'><a href="Bus/I2C.html#bus-class_method" title="Bus::I2C.bus (method)">bus</a></span></span>
426
- <span class='ivar'>@device</span> <span class='op'>=</span> <span class='const'>I2CDevice</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='label'>address:</span> <span class='const'><span class='object_link'><a href="#DEVICE-constant" title="BH1750::DEVICE (constant)">DEVICE</a></span></span><span class='comma'>,</span> <span class='label'>driver:</span> <span class='const'>I2CDevice</span><span class='op'>::</span><span class='const'>Driver</span><span class='op'>::</span><span class='const'>I2CDev</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@i2c_bus</span><span class='rparen'>)</span><span class='rparen'>)</span>
427
- <span class='ivar'>@resolution</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="#ONE_TIME_HIGH_RES_MODE_1-constant" title="BH1750::ONE_TIME_HIGH_RES_MODE_1 (constant)">ONE_TIME_HIGH_RES_MODE_1</a></span></span>
428
- <span class='ivar'>@length</span> <span class='op'>=</span> <span class='int'>2</span>
429
- <span class='ivar'>@value</span> <span class='op'>=</span> <span class='id identifier rubyid_read_sensor'>read_sensor</span>
430
- <span class='kw'>end</span></pre>
431
- </td>
432
- </tr>
433
- </table>
434
- </div>
435
-
436
- </div>
437
-
438
-
439
- <div id="instance_method_details" class="method_details_list">
440
- <h2>Instance Method Details</h2>
441
-
442
-
443
- <div class="method_details first">
444
- <h3 class="signature first" id="lux-instance_method">
445
-
446
- #<strong>lux</strong> &#x21d2; <tt>Object</tt>
447
-
448
-
449
-
450
-
451
-
452
- </h3><div class="docstring">
453
- <div class="discussion">
454
-
455
- <p>Return value in Lux</p>
456
-
457
-
458
- </div>
459
- </div>
460
- <div class="tags">
461
-
462
-
463
- </div><table class="source_code">
464
- <tr>
465
- <td>
466
- <pre class="lines">
467
-
468
-
469
- 36
470
- 37
471
- 38
472
- 39</pre>
473
- </td>
474
- <td>
475
- <pre class="code"><span class="info file"># File 'lib/bh1750.rb', line 36</span>
476
-
477
- <span class='kw'>def</span> <span class='id identifier rubyid_lux'>lux</span>
478
- <span class='id identifier rubyid_read_sensor'>read_sensor</span>
479
- <span class='ivar'>@value</span>
480
- <span class='kw'>end</span></pre>
481
- </td>
482
- </tr>
483
- </table>
484
- </div>
485
-
486
- <div class="method_details ">
487
- <h3 class="signature " id="read_sensor-instance_method">
488
-
489
- #<strong>read_sensor</strong> &#x21d2; <tt>Object</tt>
490
-
491
-
492
-
493
-
494
-
495
- </h3><div class="docstring">
496
- <div class="discussion">
497
-
498
- <p>Read raw data from sensor and convert it to numeric</p>
499
-
500
-
501
- </div>
502
- </div>
503
- <div class="tags">
504
-
505
-
506
- </div><table class="source_code">
507
- <tr>
508
- <td>
509
- <pre class="lines">
510
-
511
-
512
- 30
513
- 31
514
- 32
515
- 33</pre>
516
- </td>
517
- <td>
518
- <pre class="code"><span class="info file"># File 'lib/bh1750.rb', line 30</span>
519
-
520
- <span class='kw'>def</span> <span class='id identifier rubyid_read_sensor'>read_sensor</span>
521
- <span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='ivar'>@device</span><span class='period'>.</span><span class='id identifier rubyid_i2cget'>i2cget</span><span class='lparen'>(</span><span class='ivar'>@resolution</span><span class='comma'>,</span> <span class='ivar'>@length</span><span class='rparen'>)</span>
522
- <span class='ivar'>@value</span> <span class='op'>=</span> <span class='id identifier rubyid_to_f'>to_f</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
523
- <span class='kw'>end</span></pre>
524
- </td>
525
- </tr>
526
- </table>
527
- </div>
528
-
529
- </div>
530
-
531
- </div>
532
-
533
- <div id="footer">
534
- Generated on Wed Dec 26 18:10:01 2018 by
535
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
536
- 0.9.16 (ruby-2.3.3).
537
- </div>
538
-
539
- </div>
540
- </body>
541
- </html>