Update: I have created a C# .Net App to connect and control the stepper Motor. The code and a Readme file is available at
https://github.com/zizwiz/Arduino_Projects/tree/main/FirmataStepperMotorTest
Initial Answer:
After a bit of thinking time I have managed to start the stepper motor running with Firmata protocol from my C# Win32 app. This post is just a basic outline I use to get it running I need lots more thinking and tinkering till I get what I need but in case this is helpful here it is.
Create a button to press to start.
Create a thread when the button is clicked
private void btn_stepper_start_Click(object sender, EventArgs e)
{
var thread = new Thread(() =>
{
while (true)
{
RunStepper();
}
});
thread.IsBackground = true;
thread.Start();
}
In the function RunStepper() create the following
private void RunStepper()
{
while (true)
{
arduino.digitalWrite(7, Convert.ToByte(255));
arduino.digitalWrite(8, 0);
arduino.digitalWrite(9, 0);
arduino.digitalWrite(10, 0);
Task.Delay(10);
arduino.digitalWrite(7, 0);
arduino.digitalWrite(8, Convert.ToByte(255));
arduino.digitalWrite(9, 0);
arduino.digitalWrite(10, 0);
Task.Delay(10);
arduino.digitalWrite(7, 0);
arduino.digitalWrite(8, 0);
arduino.digitalWrite(9, Convert.ToByte(255));
arduino.digitalWrite(10, 0);
Task.Delay(10);
arduino.digitalWrite(7, 0);
arduino.digitalWrite(8, 0);
arduino.digitalWrite(9, 0);
arduino.digitalWrite(10, Convert.ToByte(255));
Task.Delay(10);
}
}
As mentioned this small basic example is just a start to prove I may be able to do what I need.