I followed this tutorial:
I got the code from my working remote:
rcvdONOFFcodes.pdf (21.5 KB)
I then used this code to upload to the Mega with just the IR LED and transistor, cause I dont want the temp regulation bit:
#include <IRLibSendBase.h> //We need the base code
#include <IRLib_HashRaw.h> //Only use raw sender
#include <dht.h>
#define dht_apin A0 // Analog Pin sensor is connected to
dht DHT;
IRsendRaw mySender;
void setup() {
Serial.begin(9600);
delay(2000);
while (!Serial); //delay for Leonardo
Serial.println("DHT11 Humidity & temperature Sensor\n\n");
}
#define RAW_DATA_LEN 228
uint16_t rawDataOn[RAW_DATA_LEN]={
4154, 1602, 606, 1226, 606, 1226, 594, 410,
606, 406, 606, 402, 602, 1226, 602, 406,
598, 410, 602, 1230, 602, 1226, 594, 414,
602, 1230, 602, 406, 574, 434, 578, 1250,
574, 1258, 570, 438, 578, 1226, 602, 1230,
602, 406, 598, 410, 602, 1226, 606, 402,
602, 410, 602, 1226, 606, 402, 602, 406,
606, 402, 598, 410, 606, 402, 598, 406,
610, 398, 602, 406, 606, 402, 602, 406,
598, 410, 602, 406, 598, 410, 602, 406,
574, 434, 570, 434, 578, 430, 574, 1230,
602, 406, 606, 402, 602, 1230, 602, 406,
606, 402, 602, 1226, 602, 1230, 602, 406,
598, 410, 602, 406, 598, 410, 602, 406,
598, 406, 606, 1226, 606, 1222, 610, 398,
602, 1230, 602, 406, 598, 410, 602, 406,
598, 410, 570, 438, 578, 430, 570, 434,
582, 430, 570, 410, 602, 406, 598, 410,
602, 406, 598, 406, 606, 402, 602, 406,
606, 402, 602, 406, 606, 402, 602, 406,
606, 402, 602, 406, 594, 410, 602, 406,
598, 410, 602, 406, 598, 410, 602, 406,
578, 430, 570, 438, 578, 430, 570, 438,
578, 430, 570, 410, 606, 402, 598, 410,
602, 406, 598, 406, 606, 402, 602, 406,
606, 402, 602, 406, 606, 402, 602, 406,
606, 402, 602, 1226, 606, 1226, 602, 1226,
606, 402, 602, 406, 598, 410, 602, 1226,
606, 402, 578, 1000};
#define RAW_DATA_LEN 228
uint16_t rawDataOff[RAW_DATA_LEN]={
4150, 1602, 578, 1254, 578, 1254, 578, 402,
602, 406, 606, 406, 598, 1230, 602, 406,
606, 402, 602, 1230, 598, 1230, 602, 406,
606, 1226, 606, 402, 602, 406, 606, 1226,
594, 1234, 598, 410, 606, 1226, 602, 1226,
598, 410, 602, 410, 594, 1234, 598, 410,
570, 438, 574, 1258, 574, 406, 606, 430,
574, 406, 606, 402, 602, 406, 606, 402,
602, 406, 606, 402, 602, 406, 606, 402,
602, 406, 606, 402, 602, 406, 594, 414,
598, 406, 598, 410, 602, 406, 598, 410,
602, 406, 578, 430, 574, 1230, 598, 410,
606, 430, 570, 1230, 602, 1230, 602, 406,
606, 402, 602, 406, 606, 402, 602, 406,
606, 402, 602, 1226, 606, 1226, 606, 402,
598, 1234, 598, 410, 602, 406, 598, 410,
602, 406, 598, 410, 594, 410, 602, 406,
574, 434, 570, 438, 574, 434, 582, 402,
598, 410, 606, 398, 602, 406, 610, 398,
602, 406, 606, 402, 602, 406, 606, 402,
602, 406, 598, 410, 606, 402, 598, 410,
602, 406, 598, 410, 602, 402, 598, 410,
574, 434, 578, 430, 574, 434, 578, 430,
574, 434, 578, 402, 602, 406, 606, 402,
602, 406, 606, 402, 602, 406, 606, 402,
602, 406, 606, 402, 602, 406, 606, 398,
602, 406, 610, 1222, 598, 1230, 602, 406,
606, 402, 602, 406, 594, 414, 582, 1250,
570, 438, 574, 1000};
void loop() {
mySender.send(rawDataOn,RAW_DATA_LEN,36);//Pass the buffer,length, optionally frequency
}
Here is the wiring:
But nothing happens when I turn on the mega near the IR recevier of my a/c. I just noticed there is no reference to pin 3 in code, is that from the library? Any suggestions?
