{"action":"created","issue":{"url":"https://api.github.com/repos/shirriff/Arduino-IRremote/issues/173","labels_url":"https://api.github.com/repos/shirriff/Arduino-IRremote/issues/173/labels{/name}","comments_url":"https://api.github.com/repos/shirriff/Arduino-IRremote/issues/173/comments","events_url":"https://api.github.com/repos/shirriff/Arduino-IRremote/issues/173/events","html_url":"https://github.com/shirriff/Arduino-IRremote/issues/173","id":94602929,"number":173,"title":"IRsend \"breaking\" IRrecv","user":{"login":"rumpelheinz","id":12596740,"avatar_url":"https://avatars.githubusercontent.com/u/12596740?v=3","gravatar_id":"","url":"https://api.github.com/users/rumpelheinz","html_url":"https://github.com/rumpelheinz","followers_url":"https://api.github.com/users/rumpelheinz/followers","following_url":"https://api.github.com/users/rumpelheinz/following{/other_user}","gists_url":"https://api.github.com/users/rumpelheinz/gists{/gist_id}","starred_url":"https://api.github.com/users/rumpelheinz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rumpelheinz/subscriptions","organizations_url":"https://api.github.com/users/rumpelheinz/orgs","repos_url":"https://api.github.com/users/rumpelheinz/repos","events_url":"https://api.github.com/users/rumpelheinz/events{/privacy}","received_events_url":"https://api.github.com/users/rumpelheinz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-12T21:56:49Z","updated_at":"2015-07-13T10:48:25Z","closed_at":null,"body":"Hello, \r\nI am working on a project where two arduinos have to communicate back and forth, using IR. In order to get to know this library, I tried the following code, which is supposed to let one arduino send x, and then the other one receives it and then sends back x+1, going on forever.\r\n\r\n```c\r\n#include \\<IRremote.h\\>\r\n#include \\<IRremoteInt.h\\>\r\nIRsend irsend;\r\nint RECV_PIN = 11;\r\nIRrecv irrecv(RECV_PIN);\r\ndecode_results results;\r\nint i=0;\r\nvoid setup()\r\n{\r\n  Serial.begin(9600);\r\n  irsend.sendSony(1, 12); // Sony TV power code\r\n  irrecv.enableIRIn(); // Start the receiver\r\n}\r\n\r\nvoid loop() {\r\n  delay(40);\r\n  if (irrecv.decode(&results)) {\r\n    Serial.println(results.value);\r\n    irsend.sendSony(results.value+1,12);\r\n    irrecv.resume(); // Receive the next value\r\n  }\r\n}\r\n```\r\n \r\nThe code does not work, and through some debugging I've come to the conclusion, that as soon as  irsend.sendSony() is used, the irrecv object stops working correctly. Is there a reason for this, and is there a proper way to do it?\r\n\r\nI am using the \"latest release\" ( 1 ) branch.\r\n\r\nThanks in advance, Tobias \r\n\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/shirriff/Arduino-IRremote/issues/comments/120888975","html_url":"https://github.com/shirriff/Arduino-IRremote/issues/173#issuecomment-120888975","issue_url":"https://api.github.com/repos/shirriff/Arduino-IRremote/issues/173","id":120888975,"user":{"login":"rumpelheinz","id":12596740,"avatar_url":"https://avatars.githubusercontent.com/u/12596740?v=3","gravatar_id":"","url":"https://api.github.com/users/rumpelheinz","html_url":"https://github.com/rumpelheinz","followers_url":"https://api.github.com/users/rumpelheinz/followers","following_url":"https://api.github.com/users/rumpelheinz/following{/other_user}","gists_url":"https://api.github.com/users/rumpelheinz/gists{/gist_id}","starred_url":"https://api.github.com/users/rumpelheinz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rumpelheinz/subscriptions","organizations_url":"https://api.github.com/users/rumpelheinz/orgs","repos_url":"https://api.github.com/users/rumpelheinz/repos","events_url":"https://api.github.com/users/rumpelheinz/events{/privacy}","received_events_url":"https://api.github.com/users/rumpelheinz/received_events","type":"User","site_admin":false},"created_at":"2015-07-13T10:48:25Z","updated_at":"2015-07-13T10:48:25Z","body":"I have gotten it to work now , using the following code.\r\n\r\n#include <IRremote.h>\r\n#include <IRremoteInt.h>\r\n\r\nIRsend irsend;\r\nint RECV_PIN = 11;\r\nIRrecv irrecv(RECV_PIN);\r\ndecode_results results;\r\nvoid setup()\r\n{\r\n  Serial.begin(9600);\r\n  irsend.sendSony(1, 12); // Sony TV power code\r\n  delay(50);\r\n  irrecv.enableIRIn(); // Start the receiver\r\n}\r\n\r\nvoid loop() {\r\n  if (irrecv.decode(&results)) {\r\n    Serial.println(results.value);\r\n    delay(200);\r\n    irsend.sendSony(results.value+1,12);\r\n   // delay(100);\r\n    irrecv.enableIRIn(); // Start the receiver\r\n    delay(300);\r\n}\r\n\r\nThe timings weren't the problem, as I had already played around with different settings. What did it was that I now use  irrecv.enableIRIn() after every irsend.sendSony(), insetead of irrecv.resume(). \r\n\r\nTo me this seems strange, as I thought you should only use  enableIRIn() once...\r\n    \r\n   \r\n  \r\n"}}