DigitalWrite slows down
![userHead](/forum/images/userhead.png)
Hi,
i want to controll a step motor with my lattepanda and have some trouble doing so ... Everything runs fine but after some iterrations the digitalWrite slows down. Here is my Code (I use C#):
![Image](https://image.ibb.co/hGXkOH/Lattepanda_wtf.png)
as you see one iteration of swithing from LOW to HIGH is so slow that it takes up to 4 sec.
The delay is defnetly comes from calling _serialPort.Write in the Arduino class
Why is that ?
And how can i fix this ?
i want to controll a step motor with my lattepanda and have some trouble doing so ... Everything runs fine but after some iterrations the digitalWrite slows down. Here is my Code (I use C#):
Code: Select all
public static void SimpleStepMotorTest() { var arduino = new Arduino(UserSelectPort()); arduino.pinMode(10, Arduino.OUTPUT); Console.WriteLine("Press to start ..."); Console.ReadKey(); for (int i = 0; i < 1000; i++) { var watch = new Stopwatch(); watch.Start(); Thread.Sleep(5); arduino.digitalWrite(10, Arduino.HIGH); Thread.Sleep(5); arduino.digitalWrite(10, Arduino.LOW); Console.WriteLine($"Step {i} ({watch.Elapsed})"); } Console.WriteLine("Done"); Console.ReadKey(); } And here is the output on the Lattepanda ...![Image](https://image.ibb.co/hGXkOH/Lattepanda_wtf.png)
as you see one iteration of swithing from LOW to HIGH is so slow that it takes up to 4 sec.
The delay is defnetly comes from calling _serialPort.Write in the Arduino class
Why is that ?
And how can i fix this ?