brick-pi 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 52a6145f0302f94616c86ac57f985b411ccee798
4
- data.tar.gz: baa03984e55a2445f2351b46cef2c4a47baf0891
3
+ metadata.gz: 8cd74fea019cdd42e7ab6e7e4084c8f7bbad4bfc
4
+ data.tar.gz: 38583bcd636016e9b2b816f15e9ef8406c75f8aa
5
5
  SHA512:
6
- metadata.gz: 8f1caeaf3d1d7b2daad62daabaa713cb7522bb6debf10891949c28d619b2f65591f2c82ab5b8df88da1372d697b84c2ad4597a50550bf4dd22aaffa10f2a2ab6
7
- data.tar.gz: f0d2e46ab5af41b6315e3315a939a239f624bba3b05daf625fbf5fe01ee902f1f9350909bbf25155adc808921f49a4d6beb961714277b74d4a4c493baab26fef
6
+ metadata.gz: f7f070bc9cd604f8122604b7b3ff6a47c9994a7eeabc5c2abe0e3a78a7c9941dbf0cc1cc0c95755be78201eaeebdd6edcb2d59ad0678921668ec0b22f328cde7
7
+ data.tar.gz: 42c09cd79e0139e2175d011133e8a56c90bdab271a2cc02eb456d6774c8e26565caaa8f259695682dd757c14d6bcefdfde03bc3b434b893cdae3697dbcee4b29
@@ -45,12 +45,14 @@ VALUE bprb_SensorType_set(VALUE self, VALUE key, VALUE value) {
45
45
 
46
46
  VALUE bprb_Sensor_get(VALUE self, VALUE key) {
47
47
  int index = FIX2INT(key);
48
- return INT2FIX(BrickPi.Sensor[index]);
48
+ int result = BrickPi.Sensor[index];
49
+ return INT2FIX(result);
49
50
  }
50
51
 
51
52
  VALUE bprb_Encoder_get(VALUE self, VALUE key) {
52
53
  int index = FIX2INT(key);
53
- return INT2FIX(BrickPi.Encoder[index]);
54
+ int result = BrickPi.Encoder[index];
55
+ return INT2FIX(result);
54
56
  }
55
57
 
56
58
  VALUE bprb_BrickPiSetTimeout(VALUE self) {
@@ -2,3 +2,4 @@ require "brick_pi/version"
2
2
  require "brick_pi/native"
3
3
  require "brick_pi/bot"
4
4
  require "brick_pi/motor"
5
+ require "brick_pi/sensor"
@@ -3,7 +3,7 @@ include BrickPi
3
3
 
4
4
  module BrickPi
5
5
  class Bot
6
- attr_accessor :motor1, :motor2, :motor3, :motor4
6
+ attr_accessor :motor1, :motor2, :motor3, :motor4, :sensor1, :sensor2, :sensor3, :sensor4
7
7
 
8
8
  def initialize
9
9
  Native.BrickPiSetup()
@@ -11,6 +11,10 @@ module BrickPi
11
11
  @motor2 = ::BrickPi::Motor.new(Native::PORT_B)
12
12
  @motor3 = ::BrickPi::Motor.new(Native::PORT_C)
13
13
  @motor4 = ::BrickPi::Motor.new(Native::PORT_D)
14
+ @sensor1 = nil
15
+ @sensor2 = nil
16
+ @sensor3 = nil
17
+ @sensor4 = nil
14
18
  Native::Address[0] = 1
15
19
  Native::Address[1] = 2
16
20
  end
@@ -10,7 +10,7 @@ module BrickPi
10
10
  color_none: Native::TYPE_SENSOR_COLOR_NONE
11
11
  }
12
12
 
13
- PORTS = {
13
+ PORT_MAP = {
14
14
  port_1: Native::PORT_1,
15
15
  port_2: Native::PORT_2,
16
16
  port_3: Native::PORT_3,
@@ -26,7 +26,7 @@ module BrickPi
26
26
  end
27
27
 
28
28
  def read
29
- Native::Sensor[@port]
29
+ Native::Sensor[PORT_MAP[@port]]
30
30
  end
31
31
  end
32
32
  end
@@ -1,3 +1,3 @@
1
1
  module BrickPi
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brick-pi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Hays
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-30 00:00:00.000000000 Z
12
+ date: 2014-05-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  version: '0'
87
87
  requirements: []
88
88
  rubyforge_project:
89
- rubygems_version: 2.0.3
89
+ rubygems_version: 2.2.2
90
90
  signing_key:
91
91
  specification_version: 4
92
92
  summary: Ruby library to run the BrickPi drivers for Lego Mindstorms