rotor 0.0.9 → 0.0.10

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: aa2fcf001b7e6b6b5e85665dddef2e60e7e2c3f5
4
- data.tar.gz: 2bacd1a6fe7eb1f2059cc33475353edfae4a7021
3
+ metadata.gz: 749e70524d5cd517fec84abfafd70ea35791a3b6
4
+ data.tar.gz: 8f3f7295f4423fedeeb579fb99e1085408f40499
5
5
  SHA512:
6
- metadata.gz: 7724f36d2c54faa710930479ffffc837c6891ebe83410f10b467972adb9df55e66720efde485f67a6ebc8e8293773ec66382eaa4bd6bbd038ab1f6b8a103aa20
7
- data.tar.gz: 8e61f974397d41c4a611107641ade1303200c20701415dd2267f18720aa11d2677a235a8aa4a66c17876d7693d169cd0025e00fb29c927b98df4e9c63bfb8ffa
6
+ metadata.gz: cf6377a70975b031edac451120b6d7ae201f5acb937481e1ce3f3f8c16c8bc039f74bd901dc68823acb67b09ec24645713c537f1cba8d7973c33a42a5aabb826
7
+ data.tar.gz: 473517bc860cff6ebc4f71bcb3c956eb676523725ba7d7bdd26c4bbd4adb19ae3ed03526c306000c92bc7b57f8c244ab359e1c97753b8f116ea2731a0aa3fcf3
data/lib/rotor/motor.rb CHANGED
@@ -2,7 +2,7 @@ require 'wiringpi'
2
2
 
3
3
  module Rotor
4
4
  class Stepper
5
- def initialize(coil_A_1_pin, coil_A_2_pin, coil_B_1_pin, coil_B_2_pin, enable_pin=nil)
5
+ def initialize(coil_A_1_pin, coil_A_2_pin, coil_B_1_pin, coil_B_2_pin, enable_pin=nil, homing_switch, homing_normally)
6
6
  @io = WiringPi::GPIO.new(WPI_MODE_GPIO)
7
7
  @coil_A_1_pin = coil_A_1_pin
8
8
  @coil_A_2_pin = coil_A_2_pin
@@ -10,6 +10,8 @@ module Rotor
10
10
  @coil_B_2_pin = coil_B_2_pin
11
11
  @enable_pin = enable_pin
12
12
 
13
+ @homing_switch = homing_switch
14
+ @homing_normally = homing_normally
13
15
  [@coil_A_1_pin, @coil_A_2_pin, @coil_B_1_pin, @coil_B_2_pin].each do |pin|
14
16
  `echo #{pin} > /sys/class/gpio/unexport`
15
17
  @io.mode(pin,OUTPUT)
@@ -59,14 +61,14 @@ module Rotor
59
61
  @io.write(@coil_B_2_pin, w4)
60
62
  end
61
63
 
62
- def set_home(coord=0, direction, homing_switch, homing_normally)
63
- `echo #{homing_switch} > /sys/class/gpio/unexport`
64
- @io.mode(homing_switch,INPUT)
64
+ def set_home(direction)
65
+ `echo #{@homing_switch} > /sys/class/gpio/unexport`
66
+ @io.mode(@homing_switch,INPUT)
65
67
  @move = true
66
68
  while @move == true
67
- backwards(2,1) if direction == :backwards #&& @io.read(homing_switch) == homing_normally
68
- forward(2,1) if direction == :forward #&& @io.read(homing_switch) == homing_normally
69
- @move = false unless @io.read(homing_switch) == homing_normally
69
+ backwards(2,1) if direction == :backwards #&& @io.read(@homing_switch) == @homing_normally
70
+ forward(2,1) if direction == :forward #&& @io.read(@homing_switch) == @homing_normally
71
+ @move = false unless @io.read(@homing_switch) == @homing_normally
70
72
  end
71
73
  end
72
74
 
data/lib/rotor/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rotor
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rotor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - kobaltz