I'm playing around with a pair of 433MHz receiver/transmitters and while everything works great on the transmitting part, I was trying to pair two espruinos (as test-replacement while waiting for my NRF24L01+).
The problem I ran into is that when I set watches for the receiver it seems to put too much load on the board, making it nearly impossible to run anything else.
Is there a trick to handle the receiving part with less processing power or is this a waste of time and I shouldn't even try?
As soon as I pull the plug from A0 (data line), the terminal becomes responsive again.
I just used one of the example snippets:
var t,n;
// When the signal rises, check if it was after ~5ms of delay - if so (and if we have a code) display it.
function sigOn(e) {
var d = e.time-t;
if (d>0.005 && n>0) {
console.log("0b"+n.toString(2));
n=0;
}
t = e.time;
}
// When the signal falls, measure the length of our pulse.
// If it was within range, record a 1 or a 0 depending on the length.
// If it wasn't in range, zero it
function sigOff(e) {
var d = e.time-t;
t = e.time;
if (d>0.0001 && d<0.001)
n = (n<<1) | ((d>=0.0004)?1:0);
else
n=0;
}
setWatch(sigOn,A0,{repeat:true,edge:"rising"});
setWatch(sigOff,A0,{repeat:true,edge:"falling"});
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.
Hi!
I'm playing around with a pair of 433MHz receiver/transmitters and while everything works great on the transmitting part, I was trying to pair two espruinos (as test-replacement while waiting for my NRF24L01+).
The problem I ran into is that when I set watches for the receiver it seems to put too much load on the board, making it nearly impossible to run anything else.
Is there a trick to handle the receiving part with less processing power or is this a waste of time and I shouldn't even try?
As soon as I pull the plug from A0 (data line), the terminal becomes responsive again.
I just used one of the example snippets:
Thanks for any advice!
Mario