Hello, So I am trying to develop a custom IR remote for a Lasko space heater I have. It already has a remote but I wanted to make a custom one with arduino. The first step I did was created an IR receiving sketch to capture the RAW codes from the remote I have right now.
#include <ir_Lego_PF_BitStreamEncoder.h>
#include <boarddefs.h>
#include <IRremoteInt.h>
#include <IRremote.h>
// If one keypress results in multiple codes being output, then
// change in IRremoteInt.h:
// #define _GAP 50000
// This sketchThis sketch was obtained from:
// For more info:
// jason welsh
// https://www.youtube.com/watch?v=eR8sQq3pl20
// https://docs.google.com/document/d/1QgmFbFlB0aI3swrhQkacRe3C-cIS0p1t0TV36-i2lLo/edit
// http://www.instructables.com/id/Arduino-Remote-Control-Less-10/?ALLSTEPS
/////////////////////////////////
// I made a few small changes
#include <IRremote.h>
int RECV_PIN = 9;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
int c = 0;
void dump(decode_results *results) {
int count = results->rawlen;
Serial.println(c);
c++;
Serial.println("For IR Scope: ");
for (int i = 1; i < count; i++) {
if ((i % 2) == 1) {
Serial.print("+");
Serial.print(results->rawbuf[i]*USECPERTICK, DEC);
}
else {
Serial.print(-(int)results->rawbuf[i]*USECPERTICK, DEC);
}
Serial.print(" ");
}
Serial.println("");
Serial.println("For Arduino sketch: ");
Serial.print("unsigned int raw");
Serial.print(c);
Serial.print("[");
Serial.print(count, DEC);
Serial.print("] = {");
for (int i = 1; i < count; i++) {
if ((i % 2) == 1) {
Serial.print(results->rawbuf[i]*USECPERTICK, DEC);
}
else {
Serial.print((int)results->rawbuf[i]*USECPERTICK, DEC);
}
Serial.print(",");
}
Serial.print("};");
Serial.println("");
Serial.print("irsend.sendRaw(");
Serial.print("raw");
Serial.print(c);
Serial.print(",");
Serial.print(count, DEC);
Serial.print(",38);");
Serial.println("");
Serial.println("");
}
void loop() {
if (irrecv.decode(&results)) {
dump(&results);
irrecv.resume(); // Receive the next value
}
}
I then took the 24 bit array and copied it into a transmitting sketch.
/*
* IRremote: IRsendDemo - demonstrates sending IR codes with IRsend
* An IR LED must be connected to Arduino PWM pin 3.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*/ // http://www.instructables.com/id/Arduino-Remote-Control-Less-10/?ALLSTEPS
#include <IRremote.h>
#include <SoftwareSerial.h>
SoftwareSerial BT(10, 11); // TX, RX
String readdata;
IRsend irsend; // An IR LED must be connected to Arduino PWM pin 3.
//here put your raw code//
unsigned int raw1[24] = {1250,450,1300,400,400,1300,1250,450,1250,450,400,1250,450,1250,450,1250,450,1250,400,1300,400,1300,1250,};
void setup()
{
Serial.begin(9600);
BT.begin(9600);
}
void loop() {
delay(3000);
irsend.sendRaw(raw1,24,38);
Serial.println("Sending Code");
}
When uploaded to the arduino with an infrared led I know it transmits properly since I ran the receiving sketch on a separate arduino and it was able to capture the the RAW codes from the transmitting one, however it won’t turn on my heater. I have tried recapturing the codes and changing the infrared leds but no matter what It won’t turn on the heater. Any advice to get it to work properly?