| gclib 1.34.15 Communications API for Galil controllers and PLCs |

jog.cs
Go to the documentation of this file.
1
10 using System;
11
12 namespace examples
13 {
14 public static partial class Examples
15 {
34
35 public static int Jog(gclib gclib)
36 {
37 gclib.GCommand("ST"); // Stop all motors
38 gclib.GMotionComplete("A"); // Wait for motion to complete
39 gclib.GCommand("SHA"); // Set servo here
40 gclib.GCommand("DPA=0"); // Start position at absolute zero
41 gclib.GCommand("JGA=0"); // Start jogging with 0 speed
42 gclib.GCommand("BGA"); // Begin motion on A Axis
43
44 bool isJogging = true;
45 int speed = 0;
46
47 Console.WriteLine("Enter a character on the keyboard to change the" +
48 " motor's speed:\n<q> Quit\n<a> -2000 counts/s\n" +
49 "<s> -500 counts/s\n<d> +500 counts/s\n<f> " +
50 "+2000 counts/s\n<r> Direction Reversal\n");
51
52 while (isJogging)
53 {
54 gclib.GCommand("JGA=" + speed);
55
56 Console.WriteLine("Jog Speed: " + speed);
57
58 switch (Console.ReadKey(true).Key)
59 {
60 case ConsoleKey.Q:
61 isJogging = false;
62 break;
63 case ConsoleKey.A:
64 speed -= 2000;
65 break;
66 case ConsoleKey.S:
67 speed -= 500;
68 break;
69 case ConsoleKey.D:
70 speed += 500;
71 break;
72 case ConsoleKey.F:
73 speed += 2000;
74 break;
75 case ConsoleKey.R:
76 speed *= -1;
77 break;
78 }
79 }
80
81 gclib.GCommand("ST");
82 gclib.GMotionComplete("A");
83
84 return GALIL_EXAMPLE_OK;
85 }
87 }
88 }
examples.Examples.GALIL_EXAMPLE_OK
const int GALIL_EXAMPLE_OK
Examples success code.
Definition: examples.cs:29
examples.Examples.Jog
static int Jog(gclib gclib)
Puts controller into Jog Mode and accepts user input to adjust the speed.
Definition: jog.cs:35
examples
Definition: commands.cs:14