K8096-GetMoving(0)

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.

Does anyone managed to use this instruction?

thank for your answers

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);
    }

}

[quote=“jamon”]
private void timer1_Tick(object sender, EventArgs e)
{
tour = SMC.GetMoving(0);
}
}[/quote]

When do you start the timer (timer1.enabled) and what is the timer1.Interval?

ps. And yes I’ve managed your function with the K8097 board also using a timer

Greetz Deekay

HI,

Can someone show me how to code C# to access the SMC-functions?

I’m using Visuals Studio 2016 but nit able to access the SMC :frowning: