VS838 IR receiver led anyone got it working with mys?
-
@Yveaux I cannot thank you enough for doing this to try and help me out. It is really kind of you.
I am using 1.8.9 IDE as I had issues with 1.8.10 (as did others). Also I notice that you have forced 57600 as the baud rate in the sketch. Is this the magic bullet I wonder as I left mine at the default 115200 setting. I can't imagine why it would make a difference though.
I will be trying it shortly and will report back with anything I find.
I owe you a beer for sure! ;)@skywatch said in VS838 IR receiver led anyone got it working with mys?:
@Yveaux I cannot thank you enough for doing this to try and help me out. It is really kind of you.
Glad I could help!
I am using 1.8.9 IDE as I had issues with 1.8.10 (as did others).
I didn't encounter any issues with 1.8.10 so far, but I don't expect it will make a difference in your case
Also I notice that you have forced 57600 as the baud rate in the sketch. Is this the magic bullet I wonder as I left mine at the default 115200 setting. I can't imagine why it would make a difference though.
57600 is the default baud rate at 3v3 for pro mini iirr. This might be related to when using the internal oscillator and the frequency errors introduced by it. But pro mini uses an external crystal so I have to dig the datasheets to know for sure. Maybe some other forum member knows it by heart...
I owe you a beer for sure! ;)
Great! That I will remember :laughing:
-
@skywatch said in VS838 IR receiver led anyone got it working with mys?:
@Yveaux I cannot thank you enough for doing this to try and help me out. It is really kind of you.
Glad I could help!
I am using 1.8.9 IDE as I had issues with 1.8.10 (as did others).
I didn't encounter any issues with 1.8.10 so far, but I don't expect it will make a difference in your case
Also I notice that you have forced 57600 as the baud rate in the sketch. Is this the magic bullet I wonder as I left mine at the default 115200 setting. I can't imagine why it would make a difference though.
57600 is the default baud rate at 3v3 for pro mini iirr. This might be related to when using the internal oscillator and the frequency errors introduced by it. But pro mini uses an external crystal so I have to dig the datasheets to know for sure. Maybe some other forum member knows it by heart...
I owe you a beer for sure! ;)
Great! That I will remember :laughing:
@Yveaux Your code works.....until I add it to mine and then it stops working for some inexplicable reason that will drive me insane I think. ;)
I copied across your code line by line and still it refuses to 'see' any IR commands being received.I have tried excluding the watchdog, excluding the bh1750, adding arduino.h and excluding wire.h and none of those make any difference.
-
@Yveaux Your code works.....until I add it to mine and then it stops working for some inexplicable reason that will drive me insane I think. ;)
I copied across your code line by line and still it refuses to 'see' any IR commands being received.I have tried excluding the watchdog, excluding the bh1750, adding arduino.h and excluding wire.h and none of those make any difference.
-
@skywatch Maybe the cause lies outside your sketch; Are you using MySensors 2.3.2? Or do try with Arduino 1.8.10
-
@skywatch Maybe the cause lies outside your sketch; Are you using MySensors 2.3.2? Or do try with Arduino 1.8.10
@Yveaux Ihave 2 issues that I have identified, but can't work out the cause.
Issue 1 - No IR received seems to be caused by thise section of code. Commenting it out and it works as expected (but of course will never transmit).....
if (newcodeRX == 1 || lightrequest == 1) { irsend.sendNEC(INcode, 32); newcodeRX = 0; lightrequest = 0; }Second issue, is when receiving IR is working I cannot do anything useful with it. I have tried 2 methods to get a value and perform a function with it and both fail. See the 2 methods tried here......
decode_results results; if (irrecv.decode(&results)) { Serial.print("IR Received... "); Serial.println(results.value, HEX); IRin = (results.value, HEX); Serial.print(" IRin... "); Serial.println(IRin); irrecv.resume(); // Receive the next value } if (IRin == 0xFFA25D) { lights = 1; Serial.print("Lights ON... "); } if ((results.value, HEX) == 0xFFE21D) { lights = 0; Serial.print("Lights OFF... "); }I need to eat now, will get back to this later on......
-
So here is what I learned from all this....
Issue 1 - Was caused by the fact that IRsend was called at first boot - nothing wrong with that, but what I didn't know was that IRsend disables IR receive.
The solution was as simple as adding one more line to that section of code as follows.....if (newcodeRX == 1 || lightrequest == 1) { irsend.sendNEC(INcode, 32); newcodeRX = 0; lightrequest = 0; irrecv.enableIRIn(); // Start the receiver }This re-enables the receiver and then all is working as expected!
As for the second issue......Well, I'll just post the code for anyone interested.....
if (irrecv.decode(&results)) { IRin = results.value,HEX; if (IRin == 0xFFA25D) { lights = 1; Serial.print("Lights ON... "); } if (IRin == 0xFFE21D) { lights = 0; Serial.print("Lights OFF... "); } if (lights != last_lights) { saveState(10, lights); send(msgLights.set(lights)); last_lights = lights; } irrecv.resume(); // Receive the next value }It's always soooooo easy when you know how! ;)
Onwards and upwards! :)
-
So here is what I learned from all this....
Issue 1 - Was caused by the fact that IRsend was called at first boot - nothing wrong with that, but what I didn't know was that IRsend disables IR receive.
The solution was as simple as adding one more line to that section of code as follows.....if (newcodeRX == 1 || lightrequest == 1) { irsend.sendNEC(INcode, 32); newcodeRX = 0; lightrequest = 0; irrecv.enableIRIn(); // Start the receiver }This re-enables the receiver and then all is working as expected!
As for the second issue......Well, I'll just post the code for anyone interested.....
if (irrecv.decode(&results)) { IRin = results.value,HEX; if (IRin == 0xFFA25D) { lights = 1; Serial.print("Lights ON... "); } if (IRin == 0xFFE21D) { lights = 0; Serial.print("Lights OFF... "); } if (lights != last_lights) { saveState(10, lights); send(msgLights.set(lights)); last_lights = lights; } irrecv.resume(); // Receive the next value }It's always soooooo easy when you know how! ;)
Onwards and upwards! :)