I do have full control over the receiver as well. The receiver is another MDBT42Q with a female servo header soldered to it. Attaches is a photo.
It is fairly easy to open up the remote and press the reset button so I might consider locking it down fully once I have tested it extensively.
receiver.js :
global.LED2=D2;
var on = false;
function onInit()
{
}
NRF.setServices({
"3e440001-f5bb-357d-719d-179272e4d4d9": {
"3e440002-f5bb-357d-719d-179272e4d4d9": {
value : [0],
maxLen : 1,
writable : true,
//description: "PWM Throttle Input",
onWrite : function(evt) {
// Data comes in as a byte, make it 0..1 range
var n = evt.data[0] / 255;
// Send data directly to servo as PWM
analogWrite(D7, ((1.2 + n*0.8)/10)*0.5, {freq:50});
}
}
}
}, { uart : true });
NRF.setAdvertising({}, {name:"RxFlag"});
// analogWrite(D7, pwmValue);
//on disconnect return to a neutral state
NRF.on('disconnect', function() {
digitalWrite(D7,0.5);
digitalWrite(LED, false);
});
NRF.on('connect', function() {
digitalWrite(LED, true);
});
digitalWrite(LED2, true);
Is there an event that occurs when the board detects a "powering off" state? I would like to send a neutral state of 0.5 to the receiver as soon as the remote disconnects form the board.
Is it preferable to use the startBonding method of connection or is just using bluetoothdevice.connect() is fine/similar/the same?
So far, at max tx power and lowest connection internal the performance has been very good. I am hoping that the connection is stable even in less than ideal connections (I.E. downtown SF where there is a lot of random RF everywhere.)
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.
I do have full control over the receiver as well. The receiver is another MDBT42Q with a female servo header soldered to it. Attaches is a photo.
It is fairly easy to open up the remote and press the reset button so I might consider locking it down fully once I have tested it extensively.
receiver.js :
Is there an event that occurs when the board detects a "powering off" state? I would like to send a neutral state of 0.5 to the receiver as soon as the remote disconnects form the board.
Is it preferable to use the startBonding method of connection or is just using bluetoothdevice.connect() is fine/similar/the same?
So far, at max tx power and lowest connection internal the performance has been very good. I am hoping that the connection is stable even in less than ideal connections (I.E. downtown SF where there is a lot of random RF everywhere.)
1 Attachment