rotor 0.0.11 → 0.0.12

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: ea578664f5569731916a449d5ee2f5999ec2c2ce
4
- data.tar.gz: 33ff525b796c230b42cd0c07cb63dc1fdcc0f9b2
3
+ metadata.gz: c9fadcd0e45633c5bff18e886e0dabe8680d4ddb
4
+ data.tar.gz: b702a3a89dcb56f249b8d8716fe67f370a98f645
5
5
  SHA512:
6
- metadata.gz: d795f73d03848701ea4de85154950e946ec1b0f3ab60554d3db58c37e748d2d82bd573c0d0b69928d934e8d451d2494d628c04aecc7ac621e17083ffca43f5a7
7
- data.tar.gz: 48834b2946c416bfa62ae4b284615df87bd0a79876a71e74677d70e9d7a0b12c72a52e321e409f6c327e5e3f2283cdfb3a3904dc334d371c664626fb52edf59a
6
+ metadata.gz: 98db9ccd56e769430ba898949686edbc799abc64540e3503272561c17d129698a83e4760779d3bb6a403c5b4ebbf70f5e72317b6fc18c6a03149111d8376e268
7
+ data.tar.gz: 21529871f3b504787fc3a0421c17d27249717c73abf6ba51b2e4e4c89d1abc7faadf60304f822fa2a2cc361fd9c8fabaf2242e4cf7aa7a15afbd9e2dbc069725
data/README.md CHANGED
@@ -16,6 +16,28 @@ or ULN2800 Integrated Controllers.
16
16
 
17
17
  gem install rotor
18
18
 
19
+ # Notes
20
+
21
+ Class Stepper
22
+
23
+ stepper = Rotor::Stepper.new(initialize(coil_A_1_pin, coil_A_2_pin, coil_B_1_pin, coil_B_2_pin, enable_pin=nil, homing_switch, homing_normally)
24
+ stepper.forward(delay=5,steps=100)
25
+ stepper.backwards(delay=5,steps=100)
26
+ stepper.set_home(direction) #:forward or :backwards
27
+ stepper.at_home?
28
+ stepper.at_safe_area? #opposite of at_home?
29
+
30
+ Class Servo
31
+
32
+ servo = Rotor::Servo.new(pin=18)
33
+ servo.rotate(direction) # :up or :down
34
+
35
+ Class GCode
36
+
37
+ gcode = Rotor::Gcode.new(stepper_x=nil,stepper_y=nil,stepper_z=nil,scale=1,servo=nil)
38
+ gcode.open(file)
39
+ gcode.simulate
40
+
19
41
  # Usage
20
42
 
21
43
  The goal of this gem is to make controlling your robotics easier than
@@ -27,21 +49,21 @@ or ULN2800 Integrated Controllers.
27
49
  that the panel is moving in and therefore know which side it has hit. This
28
50
  was to reduce the number of GPIO pins required.
29
51
 
30
- stepper_x = Rotor::Stepper.new(23,12,17,24,nil,13,LOW)
31
- stepper_y = Rotor::Stepper.new(25, 4,21,22,nil,19,LOW)
52
+ stepper_x = Rotor::Stepper.new(23,12,17,24,nil,13,LOW)
53
+ stepper_y = Rotor::Stepper.new(25, 4,21,22,nil,19,LOW)
32
54
 
33
55
  You can use a servo to control the marker (or leave blank if you're using a Z Axis Stepper)
34
56
  This will be built out so that the strength control of the servo (for laser power) can be
35
57
  adjusted and inputs sent in. However, for development purposes, I recommend not playing with
36
58
  lasers, but rather get the machine and code working properly first.
37
59
 
38
- servo = Rotor::Servo.new(18)
60
+ servo = Rotor::Servo.new(18)
39
61
 
40
62
  You can send the stepper motor to the outter edges of the board.
41
63
 
42
- # stepper_x.set_home(:backwards)
43
- # stepper_x.forward(1,100)
44
- # stepper_y.set_home(:forward)
64
+ # stepper_x.set_home(:backwards)
65
+ # stepper_x.forward(1,100)
66
+ # stepper_y.set_home(:forward)
45
67
 
46
68
  stepper_x = Rotor::Stepper.new(4,17,23,24,18)
47
69
  stepper_y = Rotor::Stepper.new(25,12,16,21,18)
data/lib/rotor/gcode.rb CHANGED
@@ -44,6 +44,8 @@ module Rotor
44
44
  end
45
45
  end
46
46
 
47
+ private
48
+
47
49
  def move_stepper(parsed_line,delay)
48
50
  threads = []
49
51
  [:x,:y,:z].each do |element|
@@ -71,7 +73,7 @@ module Rotor
71
73
 
72
74
  puts "Moving to G#{parsed_line[:g]} #{instance_variable_get(:"@x_move")}, #{instance_variable_get(:"@y_move")}, #{instance_variable_get(:"@z_move")}"
73
75
  threads.each { |thr| thr.join }
74
- end
76
+ end
75
77
 
76
78
  def parse_line(line)
77
79
  returned_json = {}
data/lib/rotor/servo.rb CHANGED
@@ -8,13 +8,6 @@ module Rotor
8
8
  @io.mode @pin, OUTPUT
9
9
  end
10
10
 
11
- def pulser(freq,dur)
12
- @io.write @pin, HIGH
13
- sleep (freq/1000)
14
- @io.write @pin, LOW
15
- sleep ((dur-freq)/1000)
16
- end
17
-
18
11
  def rotate(direction)
19
12
  if direction == :up
20
13
  freq = 1.0
@@ -25,5 +18,14 @@ module Rotor
25
18
  end
26
19
  25.times do;pulser(freq,20.0);end
27
20
  end
21
+
22
+ private
23
+
24
+ def pulser(freq,dur)
25
+ @io.write @pin, HIGH
26
+ sleep (freq/1000)
27
+ @io.write @pin, LOW
28
+ sleep ((dur-freq)/1000)
29
+ end
28
30
  end
29
31
  end
data/lib/rotor/stepper.rb CHANGED
@@ -60,12 +60,6 @@ module Rotor
60
60
  end
61
61
  end
62
62
 
63
- def set_step(w1, w2, w3, w4)
64
- @io.write(@coil_A_1_pin, w1)
65
- @io.write(@coil_A_2_pin, w2)
66
- @io.write(@coil_B_1_pin, w3)
67
- @io.write(@coil_B_2_pin, w4)
68
- end
69
63
 
70
64
  def set_home(direction)
71
65
  puts "Setting #{direction} with Homing on GPIO #{@homing_switch}"
@@ -91,6 +85,15 @@ module Rotor
91
85
  else
92
86
  return true
93
87
  end
88
+ end
89
+
90
+ private
91
+
92
+ def set_step(w1, w2, w3, w4)
93
+ @io.write(@coil_A_1_pin, w1)
94
+ @io.write(@coil_A_2_pin, w2)
95
+ @io.write(@coil_B_1_pin, w3)
96
+ @io.write(@coil_B_2_pin, w4)
94
97
  end
95
98
  end
96
99
  end
data/lib/rotor/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rotor
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
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.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - kobaltz