I am making a project and I am making three LED's blink. One blinks while one button is being pressed, another blinks when another button is pressed, and the third one stays on while both buttons are being pressed at the same time. My code works, but I would like to attach an RF transmitter and receiver to the buttons to make them wireless. Could someone please help me with the code on this?
const int ledPin= 13;
const int led1Pin= 12;
const int led2Pin= 11;
const int buttonPin= 2;
const int button1Pin= 3;
int buttonState= 0;
int button1State= 0;
void setup()
{
pinMode(buttonPin, INPUT);
pinMode(button1Pin, INPUT);
pinMode(ledPin,OUTPUT);
pinMode(led1Pin,OUTPUT);
pinMode(led2Pin,OUTPUT);
}
void loop()
{
buttonState= digitalRead(buttonPin);
button1State= digitalRead(button1Pin);
if(buttonState==LOW && button1State==LOW)
{
digitalWrite(ledPin,LOW);
digitalWrite(led1Pin,LOW);
digitalWrite(led2Pin,LOW);
}
if(buttonState==HIGH && button1State==HIGH)
{
digitalWrite(led1Pin,HIGH);}
if(buttonState==HIGH && button1State==LOW)
{digitalWrite(ledPin, HIGH);
delay(175);
digitalWrite(ledPin,LOW);
delay(175);}
if (buttonState==LOW && button1State==HIGH)
{digitalWrite(led2Pin,HIGH);
delay(175);
digitalWrite(led2Pin,LOW);
delay(175);}
}