hi im trying to make a code to do the following
i press a push button- turn on a led and send a signal to a relay 1 seg (auto turn off) when i press the push button again the led turns off and send a signal to the relay 1seg (auto turn off)
the led part i managed to find some code in the interwebs and figure out to make it work but now i can´t figure out a way to make the relay part to work
there is my code if someone can help
<
const byte buttonPin = 4;
const byte ledPin = 13;
const byte relay = 5;
updated the code with your help but now the led pin is always high and the button does not do anything (i connected a led to the relay pin (for test proposes and this one does not do anything)
const byte buttonPin = 4;
const byte ledPin = 13;
const byte relay = 5;
fixed it and now is working
basically i press a push button turns on and off a relay and turns on a led if i press again turns on and off a relay and turn the led off
const byte buttonPin = 4;
const byte ledPin = 13;
const byte relay = 5;
I just noticed you posted the code by putting <, then pasting your code, then finishing with />.
Very creative, but that is not what the <CODE/> thing in the message composition window means, that's actually a button and when you press it, you'll see it types for you
```
type or paste code here
```
so do that, leave the backticks and paste your code over "type or paste code here", then it will look like code. @JCA34F did it for you, see how nice it looks?
And beyond looking nice, it won't get mangled. All the characters you put in there will be taken literally, so they don't end up being interpreted as formatting commands.