-
-
Hi All
A while ago i promised i would write up some info about a toy I made my kids for Christmas, It's a bluetooth remote that controls a lego duplo train. It works on a MDBT42Q coding in Espruino. I finally got round to doing it on instructables
https://www.instructables.com/id/Wooden-Bluetooth-Remote-for-Lego-Duplo-Train/
Any feedback or question would very welcomed I've also entered in to toy and games contest so any votes would be very much appreciated
Once again thanks for all the help via this forum when I was making project
Many Thanks
James
-
-
Thanks Robin, that eventually worked however i realise i was missing a step and had to send a two different commands to make it work.
I managed to get me remote made in time for christmas so thank you all for you help, here a video of my remote in action
https://www.instagram.com/p/B6inY2XgasT/?igshid=16amjui8jcves
I hope you all had great a christmas
-
-
Sorry To keep asking,
I am seem to making some progress using a paired back node script and now rewriting in to use on the espruino, however I am stuck finding a way of making 'Buffer.from' working, Is there espruino equivalent ?
I am looking to run this line
const sounddata = Buffer.from([0x08, 0x00, 0x81, 0x01, 0x11, 0x51, 0x01, 0x05]);
-
Thanks For have a look Robin is this a better layout ?
var devices; var gatt; var DevName="e0:7d:ea:0c:03:29"; var serviceUUID="00001623-1212-efde-1623-785feabcd123"; var characteristicUUID="00001624-1212-efde-1623-785feabcd123"; var MessageToSend=[0x81, 0x00, 0x11, 0x51, 0x00, 0x64]; pinMode(D15, 'input_pulldown'); global.LED2=D2; NRF.connect("e0:7d:ea:0c:03:29").then(function(g) { console.log("Starting connecting"); gatt = g; return gatt.getPrimaryService("00001623-1212-efde-1623-785feabcd123"); }).then(function(service) { return service.getCharacteristic("00001624-1212-efde-1623-785feabcd123"); }).then(function(characteristic) { return characteristic.writeValue(MessageToSend); }).then(function() { //gatt.disconnect(); console.log("Done!"); }); function send_message() { console.log("Moving Train"); NRF.nfcSend(new Uint8Array([0x81, 0x00, 0x11, 0x51, 0x00, 0x64])); } function train_disconnect() { console.log("Disconnecting"); gatt.disconnect(); } setInterval(function() { digitalWrite(LED2, digitalRead(D15)); if (digitalRead(D15) == 1) { send_message(); } console.log("Button pressed", digitalRead(D15)); }, 300);
-
Hi All
Thanks allobjects that helped but my progress is still quite slow, i have managed to connect to the train and disconnect but can't work out the best way to send the buffer. I am still trying to get my head around javascript so maybe missing something quite obvious
here's my current code
var devices;
var gatt;
var DevName="e0:7d:ea:0c:03:29";
var serviceUUID="00001623-1212-efde-1623-785feabcd123";
var characteristicUUID="00001624-1212-efde-1623-785feabcd123";
var MessageToSend=[0x81, 0x00, 0x11, 0x51, 0x00, 0x64];
pinMode(D15, 'input_pulldown');
global.LED2=D2;NRF.connect("e0:7d:ea:0c:03:29").then(function(g) {
console.log("Starting connecting");
gatt = g;
return gatt.getPrimaryService("00001623-1212-efde-1623-785feabcd123");
}).then(function(service) {
return service.getCharacteristic("00001624-1212-efde-1623-785feabcd123");
}).then(function(characteristic) {
return characteristic.writeValue(MessageToSend);
}).then(function() {
//gatt.disconnect();
console.log("Done!");
});function send_message() {
console.log("Moving Train");
NRF.nfcSend(new Uint8Array([0x81, 0x00, 0x11, 0x51, 0x00, 0x64]));
}function train_disconnect() {
console.log("Disconnecting");
gatt.disconnect();
}setInterval(function() {
digitalWrite(LED2, digitalRead(D15));
if (digitalRead(D15) == 1) {send_message();
}
console.log("Button pressed", digitalRead(D15));
}, 300);any advice would be greatly appreciated
Cheers
James
-
Thanks the lego link very helpful
Yes it looks like the message it send contains the 16 bytes in hex followed buffer string that appears to vary in length. ie Buffer 05 00 01 02 02 or 0a 00 41 00 00 01 00 00 00 01
sorry didn't realise i was using two account the previous message was sent from my work.
-
Hi All
Just a little update, I've managed to hack in the node-module when it's running on my mac and got it print me the code for certain commands, so it should be a little simpler
If anyone could point me in right direct for the best way to this raw data to my device that would be grand
"Code to Send: 00001624-1212-efde-1623-785feabcd123 Buffer 81 00 11 51 00 64"
I am very greatful for any help
James
-
Thanks for everyone for the reply, Yes it looks like the the modules is multi files, and it seems very complicated to try and combine into one.
The project is to try and make a remote for daughters bluetooth lego train, it had working in browser so was hoping to port it over but nothing is ever that simple
I am currently trying to see adapting 'Bluetooth LE HID Keyboards' library work. I just need to try and find the correct modifier keys
Wish me luck
-
-
Hi There
I was wondering if anyone could offer some advice. I looking to connect to external bluetooth device using javascript. I have it working on my mac in javascript however is it possible to upload this to espruino and it work ?
If so what board would it be best to use I am guessing it will be a MDBT42Q
I am afriad i very new to Espruino and my Javascript is a little basic but i been messing about with arduino for years
Any help would be greatly appricated
Cheers
James
Thanks I've changed it to javascript
the direction works between the number so grater that 100 but less that 200 set this speed
ie