I tried changing the results.value to some random signal (0xFFFFFFFF) in the if statement after the led blink. This did not fix my problem. Is there a way to somehow "trick" the arduino into thinking it has received a signal through the IR Receiver without actually anything being sent from the transmitter circuit?
I don't believe my issue is the receiver. It is most probably has to do with how I am transmitting the IR. I believe this to be the case because, as I stated earlier, the receiver works perfectly when I use spark fun's IR remote: shttps://www.sparkfun.com/products/11759.
As for the comments; I think there were some leftover comments from me stripping the program down to its bare minimums but now there shouldn't be anything extra. Sorry for the confusion.
Here is my most recent code for the transmitter:
#include <IRremote.h> // Include the IRremote library
IRsend irsend; // Enables IR transmit on pin 3
const int buttonPin = 12; // Button pin. Pulled up. Triggered when connected to ground.
// setup() initializes serial
void setup()
{
Serial.begin(9600);
pinMode(buttonPin, INPUT_PULLUP);
}
// loop() checks for a button press
void loop()
{
// If the button is pressed...
if (digitalRead(buttonPin) == LOW)
{
sendCode(); // Sends out our code. (See bottom of sketch).
}
}
void sendCode()
{
irsend.sendNEC(0x10EFD827, 32);
Serial.println("Sent NEC Power");
delay(3000);
}
And here is my most recent code for the Receiver:
#include <IRremote.h>
int IRpin = 11; // pin for the IR sensor
int LEDb = 12; // blue LED pin
int LEDg = 8; // green LED pin
IRrecv irrecv(IRpin);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
pinMode(LEDb, OUTPUT);
pinMode(LEDg, OUTPUT);
}
void loop()
{
if (irrecv.decode(&results))
{
irrecv.resume(); // Receive the next value
}
if (results.value == 0x10EFD827) // NEC value to be recieved (Power Button)
{
delay(100);
digitalWrite(LEDb, HIGH);
delay(2000); // wait 1 second
digitalWrite(LEDb, LOW);
delay(100); // keeps the transistion smooth
}
if (results.value == 0x10EFF807) // NEC value to be recieved (A Button)
{
digitalWrite(LEDg, HIGH);
delay(2000); // wait 1 second
digitalWrite(LEDg, LOW);
delay(100); // keeps the transistion smooth
}
results.value == 0;
}