Strange - I guess one thought is that the PIRs may not behave as well off the slightly lower voltage?
Are you printing lots of text? When you disconnect from USB, Espruino swaps to Serial1 at 9600 baud on B6/B7 pins. If you print a lot then it could take a lot of time to finish, which could cause problems with the rest of your code.
Also, is everything grounded together? Sometimes people forget to make everything share the same GND, and the fact that GND comes from the PC sometimes makes it work when USB is connected, but fail when it's not.
If you have a USB-TTL converter handy, you can actually wire it up to GND, B6 and B7, and then connect to that with the Web IDE (at 9600 baud, which should be the default). It'll then let you to debug Espruino while it's running entirely off battery power, which might help?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Strange - I guess one thought is that the PIRs may not behave as well off the slightly lower voltage?
Are you printing lots of text? When you disconnect from USB, Espruino swaps to Serial1 at 9600 baud on B6/B7 pins. If you print a lot then it could take a lot of time to finish, which could cause problems with the rest of your code.
Also, is everything grounded together? Sometimes people forget to make everything share the same GND, and the fact that GND comes from the PC sometimes makes it work when USB is connected, but fail when it's not.
If you have a USB-TTL converter handy, you can actually wire it up to GND, B6 and B7, and then connect to that with the Web IDE (at 9600 baud, which should be the default). It'll then let you to debug Espruino while it's running entirely off battery power, which might help?