Bluetooth Lego Train Remote

Posted on
  • 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

  • Pretty cool :)
    Just some nitpicking: You wrote "java" twice, but it's javascript, not java :)
    And I think there is a bug in train_direction: if the value is 100, 200, 300, 400 or 500, sendvalue will stay at the initial [0x08, 0x00, 0x81, 0x00, 0x01, 0x51, 0x00, 0x00]. Probably would be hard to move the slider to that exact position, but still :)

  • 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

    if (dir_val < 200 && dir_val > 100) {
              const sendvalue = new Uint8Array([0x08, 0x00, 0x81, 0x00, 0x01, 0x51, 0x00, 0xce]);
      }
    
  • Thank you for sharing this little bit of code, I wasted hours trying to figure out how to send hex codes to the Vent Axia Pure Sense extractor fan and with your snippet it worked a treat!

  • Wow, this is amazing! Thanks for posting this up - especially to instructables!

  • Nice hack @ThePlayShed. Just wondering , how far you can put your controller from the train before BLE disconnect.

    I was playing similar things with MiP robot. Unfortunately it disconnects from few meter(~4-5 meters) away from the controller. But get good range when using mobile phone or laptop.

  • Accidently came across this:

    [2021] Running a Lego Compatible Train With Two (x2) Micro:bits

    ...on instructables, as well:

    https://www.instructables.com/2021-Runni­ng-a-Lego-Compatible-Train-With-Two-x2-M­/

    (not using JavaScript, but still a great inspiration. There is another version: MicroBit and tablet, but I find the version with 2 micro:bits way more interesting.


    1 Attachment

    • runningTrainWith2microBits.jpg
  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Bluetooth Lego Train Remote

Posted by Avatar for ThePlayShed @ThePlayShed

Actions