Hi all new member to Forum and arduino. I am trying to nut my way through a project and have hit a stall point. Here is my situation. I am using an 8 relay bank, I have 4 buttons. Each button keeps some relays closed and opens others. The big question I have is that if one button has been activated I need to make sure the other three buttons do not work until the current button is turned off. this needs to apply to all buttons. If a button is on, other buttons just don't work until active button is off.
Any ideas on simplest way to do this would be greatly appreciated.
Did you want it to work like a blender where pushing a button 'deactivates' the other buttons before activating or do you really want to require that the active button be manually deactivated before any other button can be activated?
Rescueone:
The big question I have is that if one button has been activated I need to make sure the other three buttons do not work until the current button is turned off. this needs to apply to all buttons. If a button is on, other buttons just don't work until active button is off.
Any ideas on simplest way to do this would be greatly appreciated.
Add a global variable: "boolean AButtonIsActive = false;"
When a button is pressed:
If the button is 'active' already:
Set the button to 'inactive' and set AButtonIsActive to false.
else // The button is not active already
if (!AButtonIsActive) // Only if no button is active
Set the button to 'active' and set AButtonIsActive to true.
This will prevent any actions except deactivating the one active button or activating a button if no buttons are active.