rotor 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.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/lib/rotor/motor.rb +38 -3
- data/lib/rotor/version.rb +1 -1
- data/rotor.gemspec +1 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 045817c2e789686019b0c8e8fa2b5fac3e92a3e1
|
4
|
+
data.tar.gz: 8cdb1bf4d66cb039b5bb0c55b8238830803dd753
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd0ea3779643df75afe7021a09ca1c50650209f23d310cac6e164113ddf9591f744fd25a353a3ecb121cbae746f2343940f0498c3e4587d8792e6e3b6c827509
|
7
|
+
data.tar.gz: 95dad1ab9e906f82b7c555f6c50ce18bf85a0e6617c20822475694126b13ea9a37d4ad48c729395d05d7c44c09f1d36a8e1bed8f14c6b488b3037f58d817e0fc
|
data/.DS_Store
ADDED
Binary file
|
data/lib/rotor/motor.rb
CHANGED
@@ -1,19 +1,29 @@
|
|
1
1
|
require 'wiringpi'
|
2
|
+
require 'pi_piper'
|
3
|
+
|
2
4
|
module Rotor
|
5
|
+
include PiPiper
|
3
6
|
class Stepper
|
4
|
-
def initialize(coil_A_1_pin, coil_A_2_pin, coil_B_1_pin, coil_B_2_pin, enable_pin)
|
7
|
+
def initialize(coil_A_1_pin, coil_A_2_pin, coil_B_1_pin, coil_B_2_pin, enable_pin=nil)
|
5
8
|
@io = WiringPi::GPIO.new(WPI_MODE_GPIO)
|
6
9
|
@coil_A_1_pin = coil_A_1_pin
|
7
10
|
@coil_A_2_pin = coil_A_2_pin
|
8
11
|
@coil_B_1_pin = coil_B_1_pin
|
9
12
|
@coil_B_2_pin = coil_B_2_pin
|
10
13
|
@enable_pin = enable_pin
|
11
|
-
|
14
|
+
|
15
|
+
[@coil_A_1_pin, @coil_A_2_pin, @coil_B_1_pin, @coil_B_2_pin].each do |pin|
|
12
16
|
`echo #{pin} > /sys/class/gpio/unexport`
|
13
17
|
@io.mode(pin,OUTPUT)
|
14
18
|
@io.write(pin,LOW)
|
15
19
|
end
|
16
|
-
|
20
|
+
|
21
|
+
unless @enable_pin == nil
|
22
|
+
`echo #{@enable_pin} > /sys/class/gpio/unexport`
|
23
|
+
@io.mode(@enable_pin,OUTPUT)
|
24
|
+
@io.write(@enable_pin,LOW)
|
25
|
+
@io.write(@enable_pin,HIGH)
|
26
|
+
end
|
17
27
|
end
|
18
28
|
|
19
29
|
def forward(delay=5,steps=100)
|
@@ -50,5 +60,30 @@ module Rotor
|
|
50
60
|
@io.write(@coil_B_1_pin, w3)
|
51
61
|
@io.write(@coil_B_2_pin, w4)
|
52
62
|
end
|
63
|
+
|
64
|
+
def set_home(x_coord=0, y_coord=0, x_homing_switch, y_homing_switch, x_homing_normally_open=true, y_homing_normally_open=true)
|
65
|
+
x_homing_normally_open ? x_homing_logic = :high : x_homing_logic = :low
|
66
|
+
y_homing_normally_open ? y_homing_logic = :high : y_homing_logic = :low
|
67
|
+
|
68
|
+
@x_move = true
|
69
|
+
@y_move = true
|
70
|
+
|
71
|
+
while @x_move == true
|
72
|
+
self.backwards(10,5)
|
73
|
+
end
|
74
|
+
|
75
|
+
while @y_move == true
|
76
|
+
self.forward(10,5)
|
77
|
+
end
|
78
|
+
|
79
|
+
after :pin => x_homing_switch, :goes => x_homing_logic do
|
80
|
+
@x_move = false
|
81
|
+
end
|
82
|
+
|
83
|
+
after :pin => y_homing_switch, :goes => y_homing_logic do
|
84
|
+
@y_move = false
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
53
88
|
end
|
54
89
|
end
|
data/lib/rotor/version.rb
CHANGED
data/rotor.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rotor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kobaltz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pi_piper
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description: Ruby Gem for controlling Bipolar and Unipolar Stepper Motors
|
56
70
|
email:
|
57
71
|
- dave@k-innovations.net
|
@@ -59,6 +73,7 @@ executables: []
|
|
59
73
|
extensions: []
|
60
74
|
extra_rdoc_files: []
|
61
75
|
files:
|
76
|
+
- ".DS_Store"
|
62
77
|
- ".gitignore"
|
63
78
|
- Gemfile
|
64
79
|
- LICENSE.txt
|