I have a Modbus devices for control of wall switches (push buttons). The supplier declared that this devices have a trigger function, so on first press it goes to state 1 and on second press 0. But in reality it works correctly only 8 times from 10 because of bounce problems. So, I decided to use common mode, when it returns 1 if button is pressed and 0 if button not pressed (it does not remember the state). Now control for the state change should be implemented in OpenHub. Please help with the right code. Modbus re-read information every 200ms. State should change, when button pressed, and then it shold not change state for 4-6 seconds, I have about 50 contacts total. Is it possible to use Thread::sleep(4000) for that?
sleep willl affect only one button or all of them stop work for that time?
You might find the ideas in this thread useful