{"action":"created","issue":{"url":"https://api.github.com/repos/z3t0/Arduino-IRremote/issues/239","labels_url":"https://api.github.com/repos/z3t0/Arduino-IRremote/issues/239/labels{/name}","comments_url":"https://api.github.com/repos/z3t0/Arduino-IRremote/issues/239/comments","events_url":"https://api.github.com/repos/z3t0/Arduino-IRremote/issues/239/events","html_url":"https://github.com/z3t0/Arduino-IRremote/issues/239","id":119115020,"number":239,"title":"Help RAW with Arduino Mega for air conditioning","user":{"login":"carlosD2884","id":16039739,"avatar_url":"https://avatars.githubusercontent.com/u/16039739?v=3","gravatar_id":"","url":"https://api.github.com/users/carlosD2884","html_url":"https://github.com/carlosD2884","followers_url":"https://api.github.com/users/carlosD2884/followers","following_url":"https://api.github.com/users/carlosD2884/following{/other_user}","gists_url":"https://api.github.com/users/carlosD2884/gists{/gist_id}","starred_url":"https://api.github.com/users/carlosD2884/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlosD2884/subscriptions","organizations_url":"https://api.github.com/users/carlosD2884/orgs","repos_url":"https://api.github.com/users/carlosD2884/repos","events_url":"https://api.github.com/users/carlosD2884/events{/privacy}","received_events_url":"https://api.github.com/users/carlosD2884/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-11-27T00:56:00Z","updated_at":"2015-12-01T16:35:16Z","closed_at":null,"body":"goodnight beforehand I apologize for my English because it is very bad\r\n\r\nI am doing my job as part of the degree , I control the air conditioning right through the Arduino using an IR LED\r\n\r\nI have an Arduino MEGA\r\nI'm using the pin 12 for pin reception\r\nand modify the library to use the pin 11 for the IR LED\r\nand modify the RAWPUF 250\r\n\r\nI was able to receive and send nec encoding TV and air conditioning\r\nI have a problem with an air whose encoding is Samsung with RAWPUF [100 ]\r\n\r\nby pressing B modified frequency from 36kHz  to 40 KHz\r\nC key to modify the length of the chain from take two elements to add two elements\r\n\r\nwith the keys 1,2,3 sending the previously stored frame with the first value to be deleted without the first value and not the start bit of the code SAMSUNG\r\n\r\nattached the code I'm using , if they have any recommendations would appreciate it immensely\r\n\r\n\r\n#include <Wire.h> \r\n#include <LiquidCrystal_I2C.h>\r\n#include <Keypad.h>\r\n#include <IRremote.h>\r\n\r\nLiquidCrystal_I2C lcd(0x27,20,4);  // set the LCD address to 0x27 for a 16 chars and 2 line display\r\nconst byte ROWS = 4;\r\nconst byte COLS = 4;\r\nchar hexaKeys[ROWS][COLS] = {\r\n  {'1','2','3','A'},\r\n  {'4','5','6','B'},\r\n  {'7','8','9','C'},\r\n  {'*','0','#','D'}};  \r\nbyte rowPins[ROWS] = {22, 24, 26, 28};\r\nbyte colPins[COLS] = {23, 25, 27, 29}; \r\nKeypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS );  \r\n\r\nint RECV_PIN = 12;\r\nIRrecv irrecv(RECV_PIN);\r\nIRsend irsend;\r\n\r\ndecode_results results;\r\nint khz = 38; // 38kHz carrier frequency for the NEC protocol\r\nunsigned int irSignal1[] = {44418,4400,4400,500,1650,500,600,500,1650,500,1700,500,550,500,600,500,1650,500,600,500,600,500,1650,500,600,500,600,500,1650,500,1650,500,600,500,1650,500,1650,500,600,500,1650,500,1700,500,1650,500,1650,500,1700,500,1650,500,600,500,1650,500,600,500,550,500,600,500,600,500,600,500,550,500,600,500,600,500,550,550,550,500,600,500,600,500,550,500,600,500,1650,500,1700,500,1650,500,1650,500,1700,500,1650,500,1650,500,1650,500};\r\nunsigned int irSignal2[] = {4400,4400,500,1650,500,600,500,1650,500,1700,500,550,500,600,500,1650,500,600,500,600,500,1650,500,600,500,600,500,1650,500,1650,500,600,500,1650,500,1650,500,600,500,1650,500,1700,500,1650,500,1650,500,1700,500,1650,500,600,500,1650,500,600,500,550,500,600,500,600,500,600,500,550,500,600,500,600,500,550,550,550,500,600,500,600,500,550,500,600,500,1650,500,1700,500,1650,500,1650,500,1700,500,1650,500,1650,500,1650,500};\r\nunsigned int irSignal3[] = {560,1690,560,560,560,1690,560,1690,560,560,560,560,560,1690,560,560,560,560,560,1690,560,560,560,560,560,1690,560,1690,560,560,560,1690,560,1690,560,560,560,1690,560,1690,560,1690,560,1690,560,1690,560,1650,560,560,560,1690,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,1690,560,1690,560,1690,560,1690,560,1690,560,1690,560,1650,560,1690,500};\r\nunsigned int rawCodes[RAWBUF]; // The durations if raw\r\nint codeLen,Len1=2,Len2=2,Len3=2; // The length of the code\r\n\r\n/////////////////////////////////////////////////////////\r\n/////////////////////////////////////////////////////////\r\nvoid setup()\r\n{\r\n  Serial.begin(19200);\r\n  \r\n  lcd.begin(); \r\n  lcd.backlight();\r\n  lcd.setCursor(0,0);\r\n  lcd.print(\"lectura de control remoto\");\r\n}\r\n////////////////////////////////////////////////////////\r\n////////////////////////////////////////////////////////\r\nvoid dump(decode_results *results) \r\n{\r\n  int count = results->rawlen;\r\n  codeLen = results->rawlen - 1;\r\n  switch (results->decode_type) {\r\n    default:\r\n    case UNKNOWN:      Serial.print(\"UNKNOWN \");       break ;\r\n    case NEC:          Serial.print(\"NEC \");           break ;\r\n    case SONY:         Serial.print(\"SONY \");          break ;\r\n    case RC5:          Serial.print(\"RC5 \");           break ;\r\n    case RC6:          Serial.print(\"RC6 \");           break ;\r\n    case DISH:         Serial.print(\"DISH \");          break ;\r\n    case SHARP:        Serial.print(\"SHARP \");         break ;\r\n    case JVC:          Serial.print(\"JVC \");           break ;\r\n    case SANYO:        Serial.print(\"SANYO \");         break ;\r\n    case MITSUBISHI:   Serial.print(\"MITSUBISHI \");    break ;\r\n    case SAMSUNG:      Serial.print(\"SAMSUNG \");       break ;\r\n    case LG:           Serial.print(\"LG \");            break ;\r\n    case WHYNTER:      Serial.print(\"WHYNTER \");       break ;\r\n    case AIWA_RC_T501: Serial.print(\"AIWA_RC_T501 \");  break ;\r\n    case PANASONIC:    Serial.print(\"PANASONIC \");     break ;\r\n    case DENON:        Serial.print(\"Denon \");         break ;\r\n  }\r\n  Serial.print(results->value, HEX);\r\n  Serial.print(\"  o  \");\r\n  Serial.print(results->value, BIN);\r\n  Serial.print(\" (\");\r\n  Serial.print(results->bits, DEC);\r\n  Serial.println(\" bits)\");\r\n  Serial.print(\"Raw (\");\r\n  Serial.print(count, DEC);\r\n  Serial.print(\"): \");\r\n for (int i = 1; i <= codeLen; i++) {\r\n      if (i % 2) {\r\n        // Mark\r\n        rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK - MARK_EXCESS;\r\n      } \r\n      else {\r\n        // Space\r\n        rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK + MARK_EXCESS;\r\n      }\r\n      Serial.print(rawCodes[i - 1], DEC);\r\n      Serial.print(\",\");\r\n}\r\n    Serial.println(\"\");\r\n}\r\n////////////////////////////////////////////////////////\r\n////////////////////////////////////////////////////////\r\nvoid panellocal()\r\n{   int ww=0;\r\n  char customKey = customKeypad.getKey();\r\n  if (customKey != NO_KEY)\r\n  {\r\n    switch (customKey)\r\n    {\r\n      case 'A': irrecv.enableIRIn(); // Start the receiver\r\n                Serial.println(\"recibiendo\");\r\n     break;     \r\n     //la rutina esta diseñada entre 36 y 40 kHZ      \r\n     case 'B':  khz=36;\r\n                irsend.sendSAMSUNG(0x24d1, codeLen);\r\n                irsend.sendRaw(rawCodes, codeLen, khz); //Note the approach used to automatically calculate the size of the array.               \r\n                Serial.println(\"\");\r\n                Serial.println(\"enviando raw\");\r\n                Serial.print(\"largo de la cadena: \");\r\n                Serial.print(codeLen);\r\n                Serial.print(\" frecuencia: \");\r\n                Serial.println(khz);\r\n                delay(1000);\r\n                khz=37;\r\n                irsend.sendRaw(rawCodes, codeLen, khz); //Note the approach used to automatically calculate the size of the array.               \r\n                Serial.println(\"\");\r\n                Serial.println(\"enviando raw\");\r\n                Serial.print(\"largo de la cadena: \");\r\n                Serial.print(codeLen);\r\n                Serial.print(\" frecuencia: \");\r\n                Serial.println(khz);\r\n                delay(1000);\r\n                khz=38;\r\n                irsend.sendRaw(rawCodes, codeLen, khz); //Note the approach used to automatically calculate the size of the array.               \r\n                Serial.println(\"\");\r\n                Serial.println(\"enviando raw\");\r\n                Serial.print(\"largo de la cadena: \");\r\n                Serial.print(codeLen);\r\n                Serial.print(\" frecuencia: \");\r\n                Serial.println(khz);\r\n                delay(1000);\r\n                khz=39;\r\n                irsend.sendRaw(rawCodes, codeLen, khz); //Note the approach used to automatically calculate the size of the array.               \r\n                Serial.println(\"\");\r\n                Serial.println(\"enviando raw\");\r\n                Serial.print(\"largo de la cadena: \");\r\n                Serial.print(codeLen);\r\n                Serial.print(\" frecuencia: \");\r\n                Serial.println(khz);\r\n                delay(1000);\r\n                khz=40;\r\n                irsend.sendRaw(rawCodes, codeLen, khz); //Note the approach used to automatically calculate the size of the array.               \r\n                Serial.println(\"\");\r\n                Serial.println(\"enviando raw\");\r\n                Serial.print(\"largo de la cadena: \");\r\n                Serial.print(codeLen);\r\n                Serial.print(\" frecuencia: \");\r\n                Serial.println(khz);\r\n      break;\r\n     case 'C':  \r\n                khz=38;\r\n                Serial.print(\"codeLen-2\");\r\n                irsend.sendRaw(rawCodes, codeLen-2, khz); //Note the approach used to automatically calculate the size of the array.               \r\n                Serial.println(\"\");\r\n                Serial.println(\"enviando raw\");\r\n                Serial.print(\"largo de la cadena: \");\r\n                Serial.print(codeLen-2);\r\n                Serial.print(\" frecuencia: \");\r\n                Serial.println(khz);\r\n                Serial.print(\"codeLen-1\");\r\n                irsend.sendRaw(rawCodes, codeLen-1, khz); //Note the approach used to automatically calculate the size of the array.               \r\n                Serial.println(\"\");\r\n                Serial.println(\"enviando raw\");\r\n                Serial.print(\"largo de la cadena: \");\r\n                Serial.print(codeLen-1);\r\n                Serial.print(\" frecuencia: \");\r\n                Serial.println(khz);\r\n                Serial.print(\"codeLen\");\r\n                irsend.sendRaw(rawCodes, codeLen, khz); //Note the approach used to automatically calculate the size of the array.               \r\n                Serial.println(\"\");\r\n                Serial.println(\"enviando raw\");\r\n                Serial.print(\"largo de la cadena: \");\r\n                Serial.print(codeLen);\r\n                Serial.print(\" frecuencia: \");\r\n                Serial.println(khz);\r\n                Serial.print(\"codeLen+1\");\r\n                irsend.sendRaw(rawCodes, codeLen+1, khz); //Note the approach used to automatically calculate the size of the array.               \r\n                Serial.println(\"\");\r\n                Serial.println(\"enviando raw\");\r\n                Serial.print(\"largo de la cadena: \");\r\n                Serial.print(codeLen+1);\r\n                Serial.print(\" frecuencia: \");\r\n                Serial.println(khz);\r\n                Serial.print(\"codeLen+2\");\r\n                irsend.sendRaw(rawCodes, codeLen+2, khz); //Note the approach used to automatically calculate the size of the array.               \r\n                Serial.println(\"\");\r\n                Serial.println(\"enviando raw\");\r\n                Serial.print(\"largo de la cadena: \");\r\n                Serial.print(codeLen+2);\r\n                Serial.print(\" frecuencia: \");\r\n                Serial.println(khz);\r\n      break;\r\n      case '1': \r\n                khz=38;\r\n                irsend.sendRaw(irSignal1, sizeof(irSignal1) / sizeof(irSignal1[0]), khz); //Note the approach used to automatically calculate the size of the array.               \r\n                Serial.println(\"\");\r\n                Serial.println(\"enviando irSignal 1\");\r\n                Serial.print(\"largo de la cadena: \");\r\n                Serial.print(sizeof(irSignal1)/ sizeof(irSignal1[0]) ); //sizeof(irSignal1)/ sizeof(irSignal1[0])\r\n                Serial.print(\" frecuencia: \");\r\n                Serial.println(khz);\r\n      break;\r\n      case '2': \r\n                khz=38;\r\n                irsend.sendRaw(irSignal2, sizeof(irSignal2) / sizeof(irSignal2[0]), khz); //Note the approach used to automatically calculate the size of the array.               \r\n                Serial.println(\"\");\r\n                Serial.println(\"enviando irSignal 2\");\r\n                Serial.print(\"largo de la cadena: \");\r\n                Serial.print(sizeof(irSignal2)/ sizeof(irSignal2[0]));\r\n                Serial.print(\" frecuencia: \");\r\n                Serial.println(khz);\r\n      break;\r\n      case '3': \r\n                khz=38;\r\n                irsend.sendRaw(irSignal3, sizeof(irSignal3) / sizeof(irSignal3[0]), khz); //Note the approach used to automatically calculate the size of the array.               \r\n                Serial.println(\"\");\r\n                Serial.println(\"enviando irSignal 3\");\r\n                Serial.print(\"largo de la cadena: \");\r\n                Serial.print(sizeof(irSignal3)/ sizeof(irSignal3[0]));\r\n                Serial.print(\" frecuencia: \");\r\n                Serial.println(khz);\r\n      break;\r\n      default:Serial.println(\"no pulso nada\"); \r\n      break;   \r\n    }\r\n  }\r\n}\r\n////////////////////////////////////////////////////////\r\n////////////////////////////////////////////////////////\r\nvoid loop()\r\n{\r\n  if (irrecv.decode(&results)) \r\n  {\r\n    //Serial.println(results.value, HEX);\r\n    dump(&results);\r\n    irrecv.resume(); // Receive the next value\r\n  }    \r\npanellocal();\r\n}\r\n\r\n\r\n/*\r\n * \r\n * ..................................................................\r\naire cuarto de mi papa\r\n\r\nDecoded NEC: 8166817E (32 bits)\r\n\r\nRaw (68): 6430,8950,4450,550,1650,550,550,550,550,550,550,550,550,550,550,550,550,550,1650,550,550,550,1650,550,1700,500,600,500,600,500,1700,500,1700,550,550,550,1700,500,600,500,550,550,550,550,550,550,550,500,600,500,1750,500,550,550,1700,500,1700,500,1700,550,1700,500,1700,500,1750,500,550,550\r\n..................................................................\r\ntv cuarto de mi papa\r\n\r\nDecoded NEC: 20DFC03F (32 bits)\r\n\r\nRaw (68): 2232,9000,-4500,550,-550,550,-550,600,-1650,550,-600,550,-550,550,-550,600,-550,550,-550,550,-1700,550,-1700,550,-550,550,-1700,550,-1700,550,-1700,550,-1700,550,-1650,550,-1700,550,-1700,550,-550,550,-600,550,-550,550,-600,550,-550,550,-550,600,-550,550,-550,550,-1700,550,-1700,550,-1700,550,-1650,600,-1650,550,-1700,550\r\n..................................................................\r\naire del spa\r\nDecoded NEC: C3EAD798 (32 bits)\r\nRaw (100): 18334,8850,-4500,550,-1700,550,-1700,600,-550,550,-550,550,-550,600,-550,550,-1700,550,-1700,600,-1650,600,-1700,550,-1700,600,-500,600,-1700,550,-550,600,-1650,600,-500,600,-1700,550,-1700,600,-500,600,-1650,600,-550,550,-1700,550,-1700,600,-1700,550,-1700,600,-500,600,-550,550,-1700,550,-1700,600,-500,600,-550,600,-500,600,-500,600,-550,600,-500,600,-550,550,-550,550,-1700,600,-500,600,-1700,550,-550,600,-550,550,-550,600,-500,600,-550,550,-550,550,-550,600,-550,550,\r\n..................................................................\r\naire sala papa\r\n88C0051 (28 bits)\r\nRaw (60): -28940 8450 -4250 500 -1600 550 -550 550 -550 550 -500 550 -1650 500 -550 550 -550 550 -550 500 -1650 550 -1600 550 -550 550 -500 550 -550 550 -550 550 -500 550 -550 550 -500 600 -500 550 -550 550 -550 500 -550 550 -1650 500 -550 550 -1600 550 -550 550 -550 550 -500 550 -1600 550 \r\n...................................................................\r\ntv sala papa\r\nE0E040BF (32 bits)\r\nRaw (68): -18312 4500 -4500 500 -1700 550 -1650 550 -1650 600 -550 550 -550 550 -550 550 -550 550 -600 500 -1700 550 -1650 550 -1650 550 -600 550 -550 550 -550 550 -550 550 -550 550 -550 550 -1700 550 -550 550 -550 550 -550 550 -550 550 -600 550 -550 550 -1650 550 -550 550 -1700 550 -1650 550 -1650 550 -1700 550 -1650 550 -1650 550 \r\n..................................................................\r\ntv mi cuarto\r\n71F9F1D7\r\nUnknown encoding: 71F9F1D7 (32 bits)\r\nRaw (38): 17290,8250,-4200,450,-550,500,-550,500,-1550,500,-550,500,-1550,500,-550,500,-500,500,-550,500,-4100,550,-1550,500,-500,550,-1550,500,-500,550,-1500,550,-500,550,-500,500,-550,500,\r\n..................................................................\r\nrv cuerto de mi mama\r\n20DF10EF\r\nDecoded NEC: 20DF10EF (32 bits)\r\nRaw (68): 24268,9050,-4400,650,-500,600,-500,650,-1600,650,-500,600,-500,650,-500,600,-500,650,-500,600,-1650,600,-1650,600,-500,650,-1600,650,-1600,650,-1600,650,-1600,650,-1600,650,-450,650,-500,600,-500,650,-1600,650,-500,600,-500,650,-500,600,-500,650,-1600,650,-1600,650,-1600,650,-500,600,-1650,600,-1650,600,-1650,600,-1650,600,\r\n.................................................................\r\n\r\n\r\nThe .txt file is the .ino\r\n\r\n\r\n[controlremoto5.2.txt](https://github.com/z3t0/Arduino-IRremote/files/45332/controlremoto5.2.txt)"},"comment":{"url":"https://api.github.com/repos/z3t0/Arduino-IRremote/issues/comments/161024116","html_url":"https://github.com/z3t0/Arduino-IRremote/issues/239#issuecomment-161024116","issue_url":"https://api.github.com/repos/z3t0/Arduino-IRremote/issues/239","id":161024116,"user":{"login":"carlosD2884","id":16039739,"avatar_url":"https://avatars.githubusercontent.com/u/16039739?v=3","gravatar_id":"","url":"https://api.github.com/users/carlosD2884","html_url":"https://github.com/carlosD2884","followers_url":"https://api.github.com/users/carlosD2884/followers","following_url":"https://api.github.com/users/carlosD2884/following{/other_user}","gists_url":"https://api.github.com/users/carlosD2884/gists{/gist_id}","starred_url":"https://api.github.com/users/carlosD2884/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlosD2884/subscriptions","organizations_url":"https://api.github.com/users/carlosD2884/orgs","repos_url":"https://api.github.com/users/carlosD2884/repos","events_url":"https://api.github.com/users/carlosD2884/events{/privacy}","received_events_url":"https://api.github.com/users/carlosD2884/received_events","type":"User","site_admin":false},"created_at":"2015-12-01T16:35:16Z","updated_at":"2015-12-01T16:35:16Z","body":"good morning , and achieve receive and transmit the signal to go diferenes acondicinados air .\r\n\r\nThe problem that I had was the samsung for air conditioning signal should be sent twice with a pause between a sign and another 4900us .\r\n\r\nfinding : My recommendation is to continue to use the library as IRremote.h is complete only must modify RAWPUF 250"}}