433mhz led control button

I need help, how to 433mhz led control button, I don't know where there is a problem with my system, my experiment is to turn the button to press down and the led to turn on, and the button to turn to put-off the led to turn off. Now the experiment shows that the lights are all on
TR:
#include <RCSwitch.h>

int buttonPinA3 =2;
int buttonPinA4 =3;
int buttonPinA5 =4;
int buttonPinA6 =5;

int buttonState = 0;
RCSwitch mySwitch = RCSwitch();
void setup() {
pinMode(13, OUTPUT);

pinMode(buttonPinA3, INPUT_PULLUP);
pinMode(buttonPinA4 , INPUT_PULLUP);
pinMode(buttonPinA5 , INPUT_PULLUP);
pinMode(buttonPinA6 , INPUT_PULLUP);

mySwitch.enableTransmit(10);
}
void loop() {
buttonState = digitalRead(buttonPinA3 == buttonPinA4);
if (digitalRead(buttonPinA3) == HIGH) {
digitalWrite(13,HIGH);
mySwitch.send(10, 24);
} else if (digitalRead(buttonPinA4) ==HIGH) {
digitalWrite(13, HIGH);
mySwitch.send(10, 24);
} else if (digitalRead(buttonPinA5) == HIGH) {
digitalWrite(13, HIGH);
mySwitch.send(10, 24);
} else if (digitalRead(buttonPinA6) ==HIGH) {
digitalWrite(13, HIGH);
mySwitch.send(10, 24);

}
else {
mySwitch.send(20, 24);
digitalWrite(13, LOW);
}
}

RX:
#include <RCSwitch.h>
int ledpinQ1 = 3;
int ledpinQ2 = 4;
int ledpinQ3 = 5;
int ledpinQ4 = 6;
RCSwitch mySwitch = RCSwitch();
void setup() {
pinMode(ledpinQ1, OUTPUT);
pinMode(ledpinQ2, OUTPUT);
pinMode(ledpinQ3, OUTPUT);
pinMode(ledpinQ4, OUTPUT);
Serial.begin(9600);
mySwitch.enableReceive(0);
}
void loop() {
if (mySwitch.available()) {
int value = mySwitch.getReceivedValue();

if (value == 10) {
  digitalWrite(ledpin,  HIGH);
  rial.println("1");
}
else {
  digitalWrite(ledpin,LOW);
  
  Serial.println( mySwitch.getReceivedValue() );
}
mySwitch.resetAvailable();

}
}

Welcome to the Arduino forum. You need to understand that no one knows what your system consists of, nor how you have it wired together, nor how you are powering it. So, we don't know what the problem is nor where it even could be.
Help us help you.
Paul

@tomho, your topic has been moved to a more suitable location on the forum. Introductory tutorials is for tutorials the that you write, not questions :wink:

Please edit your post, select all code and click the </> button; next save your post. This will apply code tags (as described in How to get the best out of this forum, please read it) which prevents the forum software from mangling the code and makes it easier to read and copy for those that want to help you.

Hi, @tomho
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".

buttonState = digitalRead(buttonPinA3 == buttonPinA4);

should be;

buttonState = digitalRead(buttonPinA3);

It would be best if you read ALL the buttons first, store each of them as separate varaibles, then do your if.. else.. statements

Basically you take a snapshot of your inputs then test and react to them.

Do you want the LED to stay ON when you keep the button pressed, then OFF when you release the button?
OR
Do you want to press and release a button to turn the LED ON, then press and release the same button to turn the LED OFF?
OR
Do you want to press and release one button to turn a LED ON, and press and release another button to turn the same LED OFF?

Tom... :smiley: :+1: :coffee: :australia:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.