I am working with c# to adress a K8096 board.
I can connect the card, i can move my mots1 motor to the left or to the rigth.
but SMC.GetMoving(0) always return false so i am not able to know if my motor have finished to move.
Ok now it is working,
using a timer and two while loops : the first to wait the motor start and the second during the movement of the motor
namespace WindowsFormsApplication5
{
public partial class Form1 : Form
{
static public string port = “COM10”;
static public bool tour;
public Form1()
{
InitializeComponent(); tour = false;
}
private void button1_Click(object sender, EventArgs e)
{
int vitesse = System.Convert.ToInt16(textBox1.Text);
int sens=-1;
if (radio1.Checked) { sens = 1; }
else { sens = 0; }
SMC.Connect(port, 1);
bool connec = SMC.Connected(); SMC.SetDemo(true);
if (connec)
{
SMC.SetTorque(0, true);
SMC.Move(0, 2048, sens, vitesse);
while (!tour)
{
Application.DoEvents(); led1.Value = true;
}
while (tour)
{
Application.DoEvents(); led1.Value = false;
}
led1.Value = true;
SMC.Disconnect();
}
else { MessageBox.Show ("non connecté"); }
}
private void timer1_Tick(object sender, EventArgs e)
{
tour = SMC.GetMoving(0);
}