Hey guys, need some guidence for one project. I need to operate three relays in three different ways when use two buttons as:
State 1: no pressed button
State 2: when press button 1
State 3: when press button 2
Is that possible if i want to use same relay in every state? :o
It’s like you intended these to be part of an “else” clause for the preceding “if” but decided to replace “else” with “delay(1000)”.
Now you code does the delay and LOW writes to the in1 and in2 pins every time through loop.
And please don’t call output pins “in”. First “in” and “out” aren’t at all meaningful as to what the pin does, besides the fact that an output pin has no business being called in!
Now you code does the delay and LOW writes to the in1 and in2 pins every time through loop.
Yeah no, my outputs in1 and in 2 (i dont know why the hell i call them this way in first place) getting LOW as in my realy board means "ON" and not get HIGH after second, instead they just stay at LOW state for the time i pressing the button. And yes, i dont need "else", i just need to ignite counter when button is pressed and hold and end counter when release it. Thanks anyway
I wasn’t complaining about which way you were setting the logic.
I’m telling you that with buttonState HIGH you are energising and deenergising the relays Each time though loop.
Now possibly the LOW state isn’t active for long enough to effect anything as the field from the relay coil won’t collapse immediately. But I t’s still “wrong” in my book.
I had no time for testing but acheive my goal by using millis again. In this scenario void loop cycle takes zero seconds with no pressed button and in this case it works immediately when I press either of two buttons. Thanks again to all of you for the quick answers and advices. I'm going to take a cours of C/C++/C# as soon as i can, maybe after that will have the ground to built my projects easely Take care!