Store and transmit IR signal

I am making a device to mimic remote signals, pretty much a universal remote with a record and play button on it. I need to know how to program it so it stores the code when the first button is pressed and repeat that code when the other is pressed. If you can help, thank you.

here is my current code.

#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(){

pinMode(playButton, INPUT);
pinMode(recButton, INPUT);
pinMode(redPin, OUTPUT);
pinMode(irPin, OUTPUT);

void loop(){

buttonStateP = digitalRead(playButton);
buttonStateR = digitalRead(recButton);

if (buttonStateR == HIGH) {
digitalWrite(redPin, LOW);

if (buttonStateP == HIGH) {
//saved for when I learn to transmitt ir
digitalWrite(redPin, HIGH);
digitalWrite(redPin, LOW);

File->Examples->IRremote->IRrecord would be a good place to start. It shows how to record and play back an IR code. Currently it uses only one button. If the button is not pressed it will record any IR signal it sees. If the button is pressed it will send the last signal it saw. Your job will be to put those two operations under control of separate buttons.

Ok I will check that.


(What's) (with) (the) (useless) (parentheses) (?)