Jump to content
THIS IS THE TEST SITE OF EUROBRICKS!
THIS IS THE TEST SITE OF EUROBRICKS!

Train_man

Eurobricks New Members
  • Joined

  • Last visited

  1. Isnt that stuff for Power Functions not Powered up?
  2. I know this post was a while ago but this a great design and exactly what i was looking for! It took some time to find all the peices online in one place so i made a wish list on brickowl.com and the link is below for anyone that would like to buy the bits they will need. Just make an account and copy the wishlist :) Hope this makes someones life easier Edit: Forgot to post link xD https://www.brickowl.com/wishlist/view/Ganjena/main-wishlist
  3. oh nice! yes never thought about doing that... thanks :)
  4. I think ive figured it out ... The min() just makes sure the train doesnt go faster then 100. It basiclly returns the smaller of the two numbers. I think C++ doesn like concatinating strings and variables in the Serial.print functions. Ive split them out now and all seems to be working. Serial.print("Cant go faster then speed limit which is "); Serial.println(speedLimit, DEC); instead of : "Serial.print("Cant go faster then speed limit which is " + speedLimit); "
  5. Afternoon all, Im trying to create some logic that allows my kids to use the trains via the controller but the aurdino makes the trains stick to speed limits and prevents them from crashing into each other. At the moment it very basic but im having trouble with a function and im not sure what causing it. This issue: https://gyazo.com/94758aaeb2044ff75273321a48f989a9 It works fine up untill it hits the speed limit. While it does prevent the train going any faster, as you can see in the terminal it is printing BITS of a string in the "rules" function which im not even calling atm for debugging purpose and im not sure how its doing that? Have i written the function syntax correctly? Am i calling it correctly?? What should happen is if the users trys to go faster then the limit, it should print out "Serial.print("Cant go faster then speed limit which is " + speedLimit); " But its not hitting that but is printing out a random bit of the string in a function im not even calling. Its sending me crazy. Any ideas would be much appreciated ! Thanks in advance paste bin for the code should anyone want to test it: https://pastebin.pl/view/7202ee60
  6. You're right! Received my new Arduino and external BT module today and tested... It does not work with Arduino :( From what ive read their used to be a library using node.js and that allowed you to do it on the Arduino but it looked very complicated to set up and im not sure one of the dependency is being supported anymore, which is unfortunate. Like you said, i did also have the idea of the controller sending commands to the Arduino, passing them through a filter (rules of the rail) and then the Arduino sending the commands to the train as well. If i ever get this working, thats what i plan to do. I have a ESP32 ordered and will try again. Hopefully with some better luck! Not a great start to my Arduino career xD Thanks for your help
  7. Hi Cornelius, Im just getting into the arduinos and controlling lego trains. I recently bought the mega 2560 with the HM-10 Bluetooth module. Would this be compatible with your library?
  8. Thanks for the reply! Yes im aware you can use the app to make custom controlls but im intrested in coding the arduino myself hence here asking the questions. Im not sure you understood the question i asked. I need the train hubs to accept bluetooth connection from both the arduino AND the controller at the SAME time. At the moment i cant see how you can pair more then one device to a single hub?? I tested it this morning... I first paired the app on my phone but then you cant pair the controllers without disconnecting the app and vice versa. There isnt a way to ask the hub to pair without dropping the current connection. Which means only one source of controll can have control at any one time. And what im trying to achiev is the kids ability to control the trains but the arduino and sesnors would still super seed the users controls if in danager. Or is there a specific way the Legoino library allows two devices to connect to a single hub?
  9. Hi all, Not sure if this needed its own topic so ill just put this question here. Is it possible to have 2 devices (Arduino & Lego train controller) connected to a single train hub at the same time so it gets input from both? (Powered up lego) My Idea is, I would like to be able to have my kids use the trains on the track with the lego controllers but the Arduino would force the trains to adhere to the rules of the track and sensors. I. E speed limits, collision sensors (hitting the brakes), blocked sections of the track etc. I basically need the Arduino to super seed the kids controllers only to enforce a rule like speed or having to stop, so they dont crash. Any ideas would be much appreciated. Thanks in advance
Sponsored Links