-
Posts
1,241 -
Joined
-
Last visited
Content Type
Profiles
Forums
Gallery
Everything posted by Lok24
-
Control your trains without smart device - with Pybricks
Lok24 replied to Lok24's topic in LEGO Train Tech
Hi First of all: thanks for all your interest. The program was first realeased at Github, with the intention to improve it and keep it "alive", but found no interest at all. Then it was distributed in some german communities, but always in it's original form. The idea of the program and it's unusual structure was: - sepearting functions into dedicated routines (as in libs) - make behaviour adjustable by user via paramters - place them all at the beginning of the code - present them in a way, that no "python-programming" is needed to change them. So new programs with other functions (like my battery box or pendular train) could be easily written by only defining "function1" and the paramtes, all other is always the same, including the main loop ;-) If someone likes to discuss this here and improof the code (more classes instad of function, handling of remote etc), i'd like to offer same ideas ;-) Find here the Original description: Parameter und ihre Funktion: Profile Das Programm hat zwei Geschwindigkeitsprofile, mit denen in erste Linie der Grad der Beschleunigung eingestellt wird Profil_A = (5,75,10,100) #min,max,step,acc Profil_B = (5,75,5,200) #min,max,step,acc Die Motoren starten bei „min“ und laufen nicht schnell als „max“, hier also zwischen 5 und 75. Weniger als 5 ist nicht sinnvoll, 100 ist der maximale Wert. Der dritte Wert „step“ besagt um wie viele Stufen sich die Geschwindigkeit ändern soll, wenn man die Taste kurz drückt. Im ersten Fall also um 10 von 5 auf 15, 25 usw., im zweiten um 5 von 5 auf 10,15,20 usw. Der vierte Wert „acc“ gibt die Zeit an, die zwischen den Werten liegt, im ersten Fall 100 Millisekunden, im zweiten 200 ms. Das Profil B beschleunigt also in kleineren Schritten, die länger auseinanderliegen, das beschleunigt insgesamt langsamer. Drehrichtung Die Drehrichtung kann für die Motoren an A und B getrennt eingestellt werden, Werte sind 1 und -1 dirMotorA = 1 # Direction 1 or -1 dirMotorB = -1 # Direction 1 or -1 Automatische Beschleunigung autoacc = True beschleunigt automatisch weiter, wenn man die Taste gedrückt hält, bis zum Maximalwert. Mit „False“ wird immer nur bei einem erneuten Tastendruck die nächste Stufe erreicht Knöpfe Das Programm hat vier Funktionen, die hier den Knöpfen der Fernbedienung zugeordnet werden. „UP” -> Schneller „DOWN” -> Langsamer „“STOP” -> Stop „SWITCH” -> Umschalten zwischen Profil A und B Und die Fernbedienung hat sieben Knöpfe: A+","A-","A0","B+","B-","B0","CENTER" (der grüne) Das kann man dann so zuordnen: UP = "A+" DOWN = "A-" STOP = "A0" SWITCH = "CENTER" Oder auch UP = "B+" DOWN = "B-" STOP = "A0" SWITCH = "A-" Oder beliebig anders LED der Fernbedienung Einstellen der Farbe und Helligkeit der LED, jeweils bei Profil A oder B Dazu jeweils die FARBE ändern, dann kommt der Stern, und dann die Helligkeit zwischen 0 und 1 LED_A = Color.GREEN*0.05 # Remote Profil_A, color * brightness LED_B = Color.RED*0.05 # Remote Profil_B, color * brightness Das „= Color.“ muss so stehen bleiben. Gültige Farben (Großschreibung beachten!) RED ORANGE YELLOW GREEN CYAN BLUE VIOLET MAGENTA Watchdog Bei „True“ stoppen die Motoren, wenn die Fernbedienung den Kontakt verliert, bei „False“ laufen sie weiter, bis die Fernbedienung erneut Kontakt hat (erneut Knopf an der Fernbedienung drücken). watchdog = False # "True" or "False": Stop motors when loosing remote connection Timeout Gibt an, wie viele Sekunden nach dem Starten des Programmes auf eine Verbindung zur Fernbedienung gewartet wird, wird die Zeit überschritten geht das Hub aus. remoteTimeout =5 # hub waits x seconds for remote connect after starting hub Nur eine bestimmte Fernbedienung verbinden Wenn ein Wert angeben wird, kann sich nur eine Fernbedienung mit diesem Namen verbinden (der Name kann z.B. über die Powered Up App geändert werden) remoteName = "" # connect this remote only, "" connects any remote LED des Hub LEDconn gilt, wenn die Fernbedienung verbunden ist, LEDnotconn, wenn sie nicht verbunden ist, z.B. auch beim Starten des Programms. LEDconn = Color.GREEN*0.3 # if Hub connected, color * brightness LEDnotconn = Color.RED*0.5 # if Hub is not connect, color * brightness -
Control your trains without smart device - with Pybricks
Lok24 replied to Lok24's topic in LEGO Train Tech
Did you try to reconnect the FB (the green Button, as usual)? -
Answered Thx. - Need help adding PU to Emerald Express
Lok24 replied to stebai's topic in LEGO Train Tech
use bricklink: new, USA, 28 $ item No. bb0960c01 -
Pybricks Q&A
Lok24 replied to Pybricks's topic in LEGO Technic, Mindstorms, Model Team and Scale Modeling
Yes, I never found an explanation for that, should be here: https://docs.pybricks.com/en/stable/parameters/button.html but is not. -
Indeed. Normaly: Rotate clockwise till motor stalls, save position A Rotate anti-clockwise till motor stalls, save position B Rotate clockwise to B-A In your case: just drop third command. You have to check if motor is still running, that's all. 1.) Start motor A 2.) Wait 0.2 seconds 3.) Wait till A = 0 4.) Stop Motor A 5.) Set angle of A to 0 Ps: my "gaming controller" was less than 20 € .....
-
Control your trains without smart device - with Pybricks
Lok24 replied to Lok24's topic in LEGO Train Tech
Hi, don't know what version you are running, but 2.9 should still work? Older versions: Search for "Motor(port).control.limits....." and replace with "motor.obj.control.limits...." @ejayb , no I only have tacho motors and had not any problem, have a look: https://www.youtube.com/watch?v=UaNMkoPSUSA or https://www.youtube.com/watch?v=74n1VGK8jwE -
I see! very interesting, and a nice solution.
-
Is there a specific reason why you run Pybricks on the hubs?
-
Which motors have speed control with standard PF BT remotes?
Lok24 replied to The_Cook's topic in LEGO Train Tech
Yes, true, I mixed that up with the tacho function, sorry. -
Which motors have speed control with standard PF BT remotes?
Lok24 replied to The_Cook's topic in LEGO Train Tech
Only the mentioned train motor and the 45303 can be regulated with the handsets. All others offer "on and off" only with handsets. Use pybricks, a smart device, a microcontroller or modify the cables. -
Control your trains without smart device - with Pybricks
Lok24 replied to Lok24's topic in LEGO Train Tech
Hello, Sorry, no, the links don't work any more, as it took too much effort to me to adapt the programs and description to the changes pybricks made. -
Pybricks Q&A
Lok24 replied to Pybricks's topic in LEGO Technic, Mindstorms, Model Team and Scale Modeling
Yes, if you have one "master " to connect the remote and then send data to other hubs. -
EV3 Firmware Update
Lok24 replied to Fyredog's topic in LEGO Technic, Mindstorms, Model Team and Scale Modeling
I know that, but that has nothing to do with the LEGO Mindstorms Software (which should be LABVIEW). You can use a dozen of laguages and packages on the EV3. like, Ptyhon, like C++, like Java..... -
Color sensors for train automation - powered up vs mindstorms
Lok24 replied to Bartosz's topic in LEGO Train Tech
I think all the sensors have different modes (color, reclection, ambient light, distance) , therefore they might look different. Yes and no. The problem in most cases is the surface the tracks lay on. -
EV3 Firmware Update
Lok24 replied to Fyredog's topic in LEGO Technic, Mindstorms, Model Team and Scale Modeling
Is it "labview"? Where do you find Micropython there? -
EV3 Firmware Update
Lok24 replied to Fyredog's topic in LEGO Technic, Mindstorms, Model Team and Scale Modeling
No, there is need fror a specific folder. The normal OS "open File" dialog is used. Are the help fiels not included in you package? -
EV3 Firmware Update
Lok24 replied to Fyredog's topic in LEGO Technic, Mindstorms, Model Team and Scale Modeling
File -> open project -
normally the train is that quick that it flies out of the curve. I suppose you need a new motor .....
-
Hi, look from 1:00 to 1:30, the machine is much too slow. Can you easliy turn the axles of the motor and the others too?
-
Just use PU motors with tacho function. Extremly low speed, no gear at all needed , one medium linear motor, have a look: https://www.youtube.com/watch?v=UaNMkoPSUSA
-
You'll find problems running two L motors on one City Hub......
-
But they do something completly different, as they don't have any feedback (most of the PU motors have an implemented tacho and allow speed regulation via the software)
-
It is declared as "retired product" https://www.lego.com/en-us/product/simple-medium-linear-motor-45303