aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Stubs Collection/stubs/motor_loop.cs
blob: a496526858b55bdfa4c449579ad7f138f59460ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Text;
using System.Linq;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using Tango.Stubs.UI;

public void OnExecute(StubManager stubManager)
{

	// UInt32 : MotorID
	// UInt32 : MicroSteps
	// Boolean : SetMicroSteps
	// UInt32 : ACC
	// Boolean : SetACC
	// UInt32 : DEC
	// Boolean : SetDec
	// UInt32 : MaxSpeed
	// Boolean : SetMaxSpeed
	stubManager.Run("StubMotorInitRequest" ,0, 0, false, 0, false, 0, false, 0, false);	// UInt32 : MotorID
	// Boolean : Direction
	// Double : Speed
	    for (int i = 0; i < 10; i++)
    {
		stubManager.Run("StubMotorRunRequest" ,0, false, 300);//step/sec
		Thread.Sleep(100);
		// UInt32 : MotorID
		stubManager.Run("StubMotorPositionRequest" ,0);
		// UInt32 : MotorID
		// Boolean : Direction
		// Double : Speed
		stubManager.Run("StubMotorRunRequest" ,0, true, 300);//step/sec
		Thread.Sleep(100);
		// UInt32 : MotorID
		stubManager.Run("StubMotorPositionRequest" ,0);
	}
		// UInt32 : MotorID
		// Boolean : ClearStatus
		stubManager.Run("StubMotorStatusRequest" ,0, true);	    
	    // UInt32 : MotorID
		// UInt32 : StopCMD
		stubManager.Run("StubMotorStopRequest" ,0, 3);// 0 - SoftHiZ / 1 - HardHiZ  / 2 - SoftStop / 3 - HardStop
}