relayrace 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/relayrace.rb +7 -5
  2. metadata +17 -5
data/lib/relayrace.rb CHANGED
@@ -3,7 +3,7 @@ require 'serialport'
3
3
 
4
4
  class RelayrAce
5
5
 
6
- Version = '0.0.2'
6
+ Version = '0.0.3'
7
7
 
8
8
  attr_reader :port
9
9
 
@@ -19,7 +19,7 @@ class RelayrAce
19
19
  end
20
20
 
21
21
  def get_relay(relay)
22
- abort "Reads aren't working yet"
22
+ raise "Reads aren't working yet"
23
23
  end
24
24
 
25
25
  def set_relay(relay, value)
@@ -35,11 +35,11 @@ class RelayrAce
35
35
  end
36
36
 
37
37
  def get_channel(channel)
38
- abort "Reads aren't working yet"
38
+ raise "Reads aren't working yet"
39
39
  end
40
40
 
41
41
  def set_channel(channel, value)
42
- send_cmd("CH#{channel}.#{(value)? 'ON' : 'OFF'}")
42
+ send_cmd("CH#{channel}.#{(value)? 'ON' : 'OFF'}")
43
43
  end
44
44
 
45
45
  def toggle_channel(channel)
@@ -48,7 +48,9 @@ class RelayrAce
48
48
 
49
49
  def send_cmd(cmd)
50
50
  @serial.synchronize do
51
- @serial.write("\r\n#{cmd}\r\n")
51
+ @serial.write("\r\n")
52
+ 2.times { @serial.getc == ':' }
53
+ @serial.write("#{cmd}\r\n")
52
54
  end
53
55
  end
54
56
  end
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relayrace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ hash: 25
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 3
10
+ version: 0.0.3
5
11
  platform: ruby
6
12
  authors:
7
13
  - Mat Trudel
@@ -9,7 +15,7 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-06-02 00:00:00 -04:00
18
+ date: 2010-07-20 00:00:00 -04:00
13
19
  default_executable:
14
20
  dependencies: []
15
21
 
@@ -35,21 +41,27 @@ rdoc_options: []
35
41
  require_paths:
36
42
  - lib
37
43
  required_ruby_version: !ruby/object:Gem::Requirement
44
+ none: false
38
45
  requirements:
39
46
  - - ">="
40
47
  - !ruby/object:Gem::Version
48
+ hash: 3
49
+ segments:
50
+ - 0
41
51
  version: "0"
42
- version:
43
52
  required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
44
54
  requirements:
45
55
  - - ">="
46
56
  - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
47
60
  version: "0"
48
- version:
49
61
  requirements: []
50
62
 
51
63
  rubyforge_project:
52
- rubygems_version: 1.3.5
64
+ rubygems_version: 1.3.7
53
65
  signing_key:
54
66
  specification_version: 3
55
67
  summary: RelayrAce talks to Canakit USB relay boards.