ThePlayShed
Member since Nov 2019 • Last active Jul 2020Most recent activity
-
- 7 comments
- 4,522 views
-
-
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.
Dad of two little girls, I make random toys in my spare time