We have a machine that is monitoring sensors and controlling motors using a desktop app that was developed with Xojo for PI. The desktop app has some buttons for testing motors and has visual indicators of the sensor states. When the app starts, a class with a timer starts with a 10ms interval. The class checks the sensors and raises an event if one of them changes.
The machine needs to respond quickly to a sensor change. Sometimes, while the machine is running, it seems to delay a little, maybe 100ms, when responding to a sensor change. I’m thinking of trying a tight loop, rather than a timer. Something like this:
While bProcessingOn 'Check Sensor states and raise events CheckSensors App.DoEvents Loop
Is there any problem with running DoEvents on a Desktop PI App within a tight loop like this? Any other issues with this approach? Maybe I should change the app to a console app?