What's the best way to program an arduino so its sensors can be quickly polled over USB?I have a small project with a few dozen on/off contact sensors and a half-dozen analog sensors that I want to be able to quickly relay value changes to a "host" computer. It's a mobile platform, so I'd like the system to be as close to real-time as possible.My thinking is to use a pull-method by adding any sensor that's changed since the last polling to a special buffer, and when the host polls the arduino, send it the most recent values in the buffer and then clear it.Is there a more efficient push-method, where the arduino can notify the host of sensor changes?
If you really want it quick, wouldn't it be both simpler and preferable to accept a data stream over USB rather than poll a buffer? That way you minimise the operations and ensure the information is coming as fast as the Arduiono can send it. You can use "if no change do next" conditions to determine what is sent.