10-01-2024, 10:33 AM
I suspect the time delay is mostly the file operations, apart from the first one that creates the device connection. Your code (slightly modified to run) worked as expected for me with typically less than 1ms for each LDController.Buttons call.
Code:
DebugFile = Program.Directory+"\LDController.txt"
File.DeleteFile(DebugFile)
DebugLineNo = 1
While ("True")
time1 = Clock.ElapsedMilliseconds
LDButtons = LDController.Buttons(1)
time2 = Clock.ElapsedMilliseconds
LDRecord = LDButtons + " " + (time2-time1)
File.WriteLine(DebugFile, DebugLineNo, LDRecord)
DebugLineNo = DebugLineNo + 1
Program.Delay(5)
EndWhile