I want to build something that can get a signal and send it back out through some IR LEDs. Currently, I'm stuck on two things. The major thing is that after I send a signal out through my IR LED, the serial monitor stops showing data from the receiver.
I can use a remote to get the IR signals in the serial monitor, click the button that controls whether or not I am sending out IR signals, and suddenly I am no longer able to see the IR receiver serial monitor output.
the other thing is I get data like this "FFA25D" and to send it it needs to be "0xFFA25D"
#include <IRremote.h>
const int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
IRsend sender;
const int buttonPin = 6;
const int ledPin = 7;
int buttonState = 0;
void setup()
{ /* Initialize sketch */
Serial.begin(9600); // open the serial port at 9600 bps:
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT_PULLUP);
digitalWrite(ledPin, LOW);
irrecv.enableIRIn();
irrecv.blink13(true);
}
unsigned long data = 0xFF38C7;
int len = 32;
void loop ()
{
if (irrecv.decode(&results)){ // if (irrecv.decode())
Serial.println(results.value, HEX);
//data = (results.value);
irrecv.resume();
}
//delay(100);
if (digitalRead(buttonPin) == LOW) {
//Serial.println("HIGH");
sender.sendNEC(data, len);
// irrecv.resume();
digitalWrite(ledPin, HIGH);
// irrecv.resume();
}
if (digitalRead(buttonPin) == HIGH ) {
digitalWrite(ledPin, LOW);
// irrecv.resume();
}
// irrecv.resume();
}
alot of this code was Frankensteined together
im using version 2.6 of IRremote GitHub - Arduino-IRremote/Arduino-IRremote: Infrared remote library for Arduino: send and receive infrared signals with multiple protocols