Press a button to record a signal from a remote press the other to repeat it.
Write an introduction for your project
Section Header
Explain each section of your project
A picture to be added later when complete.
#include <IRremote.h>
const int playButton = 8; //to play the cloned button
const int recButton = 9; //to coppy the desiered signal
const int irPin = 11; //an indicator light
const int redPin = 7; //the ir led
const int RECV_PIN = 10; //the reciver
IRrecv irrecv(RECV_PIN);
decode_results results;
int buttonStateP = 0; //play button value
int buttonStateR = 0; //record button value
void setup(){
irrecv.enableIRIn();
pinMode(playButton, INPUT);
pinMode(recButton, INPUT);
pinMode(redPin, OUTPUT);
pinMode(irPin, OUTPUT);
pinMode(RECV_PIN, INPUT);
}
void loop(){
buttonStateP = digitalRead(playButton);
buttonStateR = digitalRead(recButton);
if (buttonStateR == HIGH) {
(irrecv.decode(&results));
digitalWrite(redPin,HIGH);
delay(200);
digitalWrite(redPin, LOW);
}
if (buttonStateP == HIGH) {
//saved for when I learn to transmitt ir
digitalWrite(redPin, HIGH);
delay(200);
digitalWrite(redPin, LOW);
}
}