smalrubot 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 642c4e0694f576d6a69d08cec9b88262e6b29da0
4
- data.tar.gz: 424fcb96c73280e5910923462386932739104b29
3
+ metadata.gz: c63e5012fe6bf9c4af243c931bb79ba528373ce3
4
+ data.tar.gz: 6d970abfe7aff0ef9c68fb88d4a4d01940082808
5
5
  SHA512:
6
- metadata.gz: 1dd5f9fdef4308f4dc800f838d232283ca95a128a4e348e56b26f073e6f16d1da85557355989cc0be54bffb39deb5580a6d089a02983b882b7fe1449ebe56f07
7
- data.tar.gz: c40522501b506db212fb971db73f3b622fe70e15e32cd9106b3cc262ad131843d79bb7029a3156f7c27a3e04127dbf1c9ba1a6661ecc0690a1ab30ae66f7f271
6
+ metadata.gz: 14ec9477102a417ad4576aa8de20d7664fedb50151aae54abc3737e6d7f599d09a64f7c574a6828192c0f871ded0a717ec440244a056bf79973accb7a08dbad2
7
+ data.tar.gz: cf1e077c3a277155fc418588dd0abdd7d0c4e29f1b51a5e30116f7012e1c71a989bf133866b571bee073dde567bc0ef30ab8cba0ed06fbbb196592c444a5e08f
@@ -28,6 +28,9 @@ module Smalrubot
28
28
  REVERSE = 1
29
29
  BRAKE = 2
30
30
  COAST = 3
31
+
32
+ ON = 1
33
+ OFF = 0
31
34
  end
32
35
  end
33
36
  end
@@ -46,6 +46,8 @@ module Smalrubot
46
46
 
47
47
  dc_motor_power: '42',
48
48
  dc_motor_control: '43',
49
+
50
+ led: '51',
49
51
  }
50
52
 
51
53
  WRITE_COMMANDS.each_key do |command|
@@ -1,3 +1,3 @@
1
1
  module Smalrubot
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
@@ -28,6 +28,9 @@ void SrStuduino::processCommand() {
28
28
  case 43:
29
29
  dcMotorControl();
30
30
  break;
31
+ case 51:
32
+ led();
33
+ break;
31
34
 
32
35
  case 61:
33
36
  getTouchSensorValue();
@@ -136,6 +139,19 @@ void SrStuduino::dcMotorControl() {
136
139
  studuino.DCMotorControl(motorPorts[pin], rotations[val]);
137
140
  }
138
141
 
142
+ /**
143
+ * !51<sensor_index><onoff>.
144
+ *
145
+ * sensor_index(2): 0-7 => PORT_A0-PORT_A7
146
+ * onoff(3): 0 => OFF or
147
+ * 1 => ON
148
+ **/
149
+ void SrStuduino::led() {
150
+ boolean onoff[] = { OFF, ON };
151
+
152
+ studuino.LED(analogPorts[pin], onoff[val]);
153
+ }
154
+
139
155
  /**
140
156
  * !61<sensor_index>.
141
157
  *
@@ -20,8 +20,11 @@ class SrStuduino : public Smalrubot {
20
20
  void setDcMotorCalibration();
21
21
  void initDcMotorPort();
22
22
  void initSensorPort();
23
+
23
24
  void dcMotorPower();
24
25
  void dcMotorControl();
26
+ void led();
27
+
25
28
  void getTouchSensorValue();
26
29
  void getLightSensorValue();
27
30
  void getIrPhotoreflectorValue();
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smalrubot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouji Takao
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-27 00:00:00.000000000 Z
11
+ date: 2015-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyserial