A couple days ago, I suddenly got a good idea to utilize the Region Detection pin6. Once the program detects the region from the level of pin 6 (float (internal pull-up): US, pull-down: EU), it is not used until all the code pulsing is finished. So, in US mode for example, after it started pulsing and when you want to stop it, forcing the pin6 to ground will exit the do loop in software and the device will go sleep. I tested both US and EU mode with modified code and worked fine. This way, you can save battery.
I added these two lines (first three lines below) into the code.
- Code: Select all
// exit do loop if REGIONSWITCH is pressed
if ((region == US && !(PINB & _BV(REGIONSWITCH)))
|| (region == EU && (PINB & _BV(REGIONSWITCH)))) break;
// delay 250 milliseconds before transmitting next POWER code
Here is the schematic for the US version. I also added a slide switch to select IR LEDs between 2 wide but short ones and 1 narrow but long beam LED.
And EU version:
If you want to have both in hand like me, you can use following design with a DPDT slide switch to change region.