BBB 0.0.4 → 0.0.5

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.
@@ -6,7 +6,7 @@ require 'BBB'
6
6
  class Circuit < BBB::Circuit
7
7
  def initialize
8
8
  # Attach temperature sensor to pin P9_40
9
- attach BBB::Components::Analog, pin: :P9_40, as: :thermometer
9
+ attach BBB::Components::AnalogComponent, pin: :P9_40, as: :thermometer
10
10
  end
11
11
  end
12
12
 
data/lib/BBB.rb CHANGED
@@ -19,10 +19,12 @@ require "BBB/adc/analog_pin"
19
19
 
20
20
  require "BBB/io/pinnable"
21
21
  require "BBB/io/digital_pin"
22
+ require "BBB/io/analog_pin"
22
23
  require "BBB/io/mock_pin"
23
24
 
24
25
  require "BBB/components/pinnable"
25
26
  require "BBB/components/led"
27
+ require "BBB/components/analog_component"
26
28
 
27
29
  require "BBB/application"
28
30
 
@@ -0,0 +1,21 @@
1
+ module BBB
2
+ module Components
3
+ class AnalogComponent
4
+ include Pinnable
5
+
6
+ attr_reader :pin
7
+
8
+ def initialize
9
+ @pin = BBB::IO::AnalogPin.new
10
+ end
11
+
12
+ def read
13
+ pin.read
14
+ end
15
+
16
+ def value
17
+ read
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module BBB
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: BBB
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -84,6 +84,7 @@ files:
84
84
  - lib/BBB/board/pin_mapper.rb
85
85
  - lib/BBB/board/test_board.rb
86
86
  - lib/BBB/circuit.rb
87
+ - lib/BBB/components/analog_component.rb
87
88
  - lib/BBB/components/led.rb
88
89
  - lib/BBB/components/pinnable.rb
89
90
  - lib/BBB/exceptions.rb