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

Recommended Posts

Posted

This work is all very fascinating, you are making PU look more and more attractive. But in my limited experience with PU (with the lego firmware) it will drop connections when at a show and there is a lot of bluetooth activity in the area. Is Pybricks more robust to bluetooth noise? Will the hub-to-hub connections potentially drop when running at a show if there is a lot of interference?

  • 3 weeks later...
  • Replies 86
  • Created
  • Last Reply

Top Posters In This Topic

Posted

@Lok24 - A quick appreciation post on version 2.9. Flashed PyBricks onto a new PoweredUp Hub, then loaded version 2.9 to be able to run 2 PoweredUp train motors on one train engine. Worked out of the box, beautifully. Really starting to appreciate the power of the PUp platform. Thanks so much!!

Quick aside: Links on 1000steine.de still point to version 2.7, and give 404 links on all the example code.

Posted
10 hours ago, Phil B said:

Links on 1000steine.de still point to version 2.7, and give 404 links on all the example code.

Yes, the article is very old, and I'm not active there any more, and as the program has been enhanced  (look the posts above) I don' distribute it any more.

Im working on a new version, with  better support for the programs "shuttle train" and "battery box".

  • 1 month later...
Posted

The code by Lok24 and modified by others is truly amazing.  However I'm having an issue that I would like to know if anyone else has had that problem.  I am attempting to use this code and pybricks to run the Lego Crocodile locomotive.  It uses the Lego Large Technic motor.  Every time I've attempted to load the program into the hub (using a different hub each time), the program will not respond.  I feel as if I am doing something wrong BUT I have been able to get the program to work on my other locomotives that run with Lego's train motors.   If no one else has this problem, ok, I understand but if someone does have it, what you have done to fix the problem.

Again, I wish to say I've been very happy with the operation except when trying to use it with my Crocodile locomotives.

 

Posted

@cbqmp27

I don't have any experience with PyBricks and @Lok24 will know much better!

I am just wondering: Do you have to tell some code lines, which motor you have attached? I guess not, as the hub figures that out (at least when running on the LEGO firmware). Also, the LEGO PUp L-motor is a tacho motor - it has a built-in rotation sensor you can use for different tasks and purposes, among which is "SetSpeed" rather than "SetPower". This is particularly interesting for the Crocodile. Using the SetSpeed command makes it run with - well constant speed. The firmware adjusts swiftly the power setting when speed is not as wanted.

But again this is all pure speculation.

Best,
Thorsten   

Posted
1 hour ago, cbqmp27 said:

The code by Lok24 and modified by others is truly amazing.  However I'm having an issue that I would like to know if anyone else has had that problem.  I am attempting to use this code and pybricks to run the Lego Crocodile locomotive.  It uses the Lego Large Technic motor.  Every time I've attempted to load the program into the hub (using a different hub each time), the program will not respond.  I feel as if I am doing something wrong BUT I have been able to get the program to work on my other locomotives that run with Lego's train motors.   If no one else has this problem, ok, I understand but if someone does have it, what you have done to fix the problem.

Again, I wish to say I've been very happy with the operation except when trying to use it with my Crocodile locomotives.

 

See @faph's comment, and also:

Make sure that the device id reported by PyBricks is in the below list. You can use the logic in this code (ripped from @Lok24's code, needs additional code to work) to test and see if your motor reports the correct id value:

 

def portcheck(i):
    # list of motors, 1 +2 contain string "DC"
    devices = {
    1: "Wedo 2.0 DC Motor",
    2: "Train DC Motor",
    38: "BOOST Interactive Motor",
    46: "Technic Large Motor",
    47: "Technic Extra Large Motor",
    48: "SPIKE Medium Angular Motor",
    49: "SPIKE Large Angular Motor",
    75: "Technic Medium Angular Motor",
    76: "Technic Large Angular Motor",
}
    port = motor[i].getPort()
    # Try to get the device, if it is attached.
    try:
        device = PUPDevice(port)
    except OSError as ex:
        if ex.args[0] == ENODEV:
            # No device found on this port.
            motor[i].setType("---")
            print(port, ": not connected")
            return ("---")
        else:
            raise

    # Get the device id
    id = device.info()['id']
Posted
14 hours ago, Phil B said:

Make sure that the device id reported by PyBricks is in the below list.

Yes, but starting the program from browser(!) shows what it does and what is connected in the lower part of the screen. So : what happens?

Posted (edited)
19 hours ago, cbqmp27 said:

The code by Lok24 and modified by others is truly amazing.  However I'm having an issue that I would like to know if anyone else has had that problem.  I am attempting to use this code and pybricks to run the Lego Crocodile locomotive.  It uses the Lego Large Technic motor.  Every time I've attempted to load the program into the hub (using a different hub each time), the program will not respond.  I feel as if I am doing something wrong BUT I have been able to get the program to work on my other locomotives that run with Lego's train motors.   If no one else has this problem, ok, I understand but if someone does have it, what you have done to fix the problem.

Again, I wish to say I've been very happy with the operation except when trying to use it with my Crocodile locomotives.

 

Hey, is PyBricks giving you an error message if you try running it while connected to a computer? I've noticed some issues with L motors recently with the script. I haven't been able to recreate the errors in a brand new script.

The error I'm encountering appears to be with interacting with the motor at all. Trying to set or read the speed fails. It's acting like the L motor has been disconnected. The program would start fine, but as soon as you would hit a button on the remote it would crash.

The issue only started showing up in newer versions of PyBricks. I was able to roll back the PyBricks version (3.2.3) and the issue went away. However, that means newer features like Broadcasting isn't avaliable.

I found someone asking the Pybricks devs directly about the error here, back in December: https://github.com/orgs/pybricks/discussions/1320

Knowing that more people are encountering the issue and not just me is a bit concerning. I'll revisit trying to fix the issue.

Edited by and_ampersand_and
Posted

Well....color me "confused"  First I thank you all for your comments and/or suggestions.  Second, I always disconnected the motor(s) before flashing the pybricks code and then the program to control it.  Lok24 mentioned running the program from within pybricks, I am not sure I understand that comment since I thought the program once sent to the hub is controlled by the lego remote, and I did try to do as he said but the program did not see the hub. 

That brings us to today.  I thought I'd try it again.  Using version 3.0 of the train control, I flashed a different hub this time and connected it up and IT WORKS as expected.  So I'll keep using it (as I was already with the train motor locos I have) but it's good to see that it also appears to now work with the technic large motor in the Crocodile locomotive.  Why it would all of the sudden work is beyond my understanding.

Thank you all again for your help.

Posted
3 minutes ago, cbqmp27 said:

I am not sure I understand that comment since I thought the program once sent to the hub is controlled by the lego remote, and I did try to do as he said but the program did not see the hub.

You can connect the hub to the browser and then start the program from within the browser.

Posted
2 hours ago, cbqmp27 said:

That brings us to today.  I thought I'd try it again.  Using version 3.0 of the train control, I flashed a different hub this time and connected it up and IT WORKS as expected.  So I'll keep using it (as I was already with the train motor locos I have) but it's good to see that it also appears to now work with the technic large motor in the Crocodile locomotive.  Why it would all of the sudden work is beyond my understanding.

Glad it's working for you. I'll need to retry my L motors with the latest version of Pybricks. Perhaps they've made a change that's fixed the issue.

 

2 hours ago, cbqmp27 said:

Lok24 mentioned running the program from within pybricks, I am not sure I understand that comment since I thought the program once sent to the hub is controlled by the lego remote, and I did try to do as he said but the program did not see the hub. 

When you connect the hub to the browser, then run the program to save it to the hub - it's actually running the program at that time. So it starts to try connecting to a remote, and if it's successful you can start controlling things with the remote. Since it's connected to the browser, data will be outputted into the console. Most importantly, if there's a crash it will tell you the error message and the line of code that it crashed on. If you run into any issues again, let us know what the error message is.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.

Announcements

  • THIS IS THE TEST SITE OF EUROBRICKS!

×
×
  • Create New...