Hi !
I know, that can be a naive question, but, als beginner what kind a question can i use ?
I'm trying to program my Arduino ONE. I have 4 switches on digital inputs wchich should do something like this :
switch 1 on (click) - make relay 1 on and after 0.5sec relay 5 on after 1 second both off
switch 1 ONE MORE TIME on (click)- make relay 1 on and after 0.5sec relay 6 on after 1 second both off
after this, when i click switch 1 on should do program (1) again and so on...
same setting i need for switch 2,3 and 4 also together with relays 5 and 6.
I'm sitting allready few hours and it goes not forward
if switchpressed == HIGH
// you need to add checking that switch is not held, only pressed - see debounce
digitalWrite(relay1, HIGH)
delay (500)
digitalWrite(relay1,LOW)
delay (500)
relaycount ++1
if relaycount > 5
relaycount = 1 // this will let you go from 5 to 1
digitalWrite (relaycount , HIGH)
delay (500)
digitalWrite (relaycount , LOW)
delay (500)
// you need to add your timing, see blink without delay.
in this case, you may want to use delay to ignore any other inputs and lock out all inputs while the unit is timing.
since you said you will use the same setting for any switch, all you need to do is create one line that tests to see if any switch is pressed.
I gave you clues. you have to write the code yourself.
Hi all
I pretty sure, that is my first shematic, so please forgive me mistakes
Now you can see how my circuit looks like. Now about function:
What it should do is to steering RC controller (433Mhz power outlet supply) wchich will be connected to those relays. Now, i've tried both programm possibilities (toggle and press-and-hold) with same result - i know to less about programming.
Those 4 switch are on my Home automation actor, they can be also programmed, i can for ex. say that one switch have to be closed for 1 or more seconds. Unfortunetly, i cannot write good programm yet
So, please don't hesitate to ask, if something is not clear !
Greetings,
M.
Switches 1-4 will activate one of four power unit, relay 5 and 6 have to send signal "on" and "off"
Swtches should not be pressed on same time Every power unit have to be controlled separetly
M.