Hey i need help please
I would like to have one button to turn on and off a led or somthing else. So a button that changes position every time you press it
const int buttonPin1 = 2;
const int Relay1 = 8;
void setup() {
pinMode(buttonPin1, INPUT);
pinMode(Relay1, OUTPUT);
}
void loop() {
if (Relay1 == LOW){
if (buttonPin1 == HIGH){
delay(500);
digitalWrite(Relay1, HIGH);
}}else{
if (Relay1 == HIGH){
if (buttonPin1 == HIGH){
delay(500);
digitalWrite(Relay1, LOW);
}
}}}
Test_1.ino (402 Bytes)