JLiu15 Posted April 28, 2023 Posted April 28, 2023 Hey guys, not sure if there's already a thread dedicated to the Powered Up app so mods feel free to move this if there's a better place for it. I'm building a remote controlled MOC using Control+ that has a 4-output distribution gearbox controlled by a rotary selector. It is basically the same setup as in the 42131 CAT D11 set. Right now, I have the controller program first rotate the gearbox motor to one of its endpoints at the start of the program, and two buttons that allow the gearbox motor to be shifted upward or downward by 90 degrees. I believe @kbalage used a similar setup to test the 42131 in his review video as the official control profile wasn't released yet at the time. However, it would be much more convenient if by pressing and holding a single button the gearbox shifts into its correct position and the motor driving the function runs until the button is released, and the gearbox moves back into its starting position at one of its endpoints. This is the way it's done in the official control profiles for sets like 42131, 42114, etc. I've tried a variety of solutions but had no luck. Does anyone know how to create such a setup, preferably with the corresponding code? Thanks! Quote
TexasEngineer454 Posted April 28, 2023 Posted April 28, 2023 Not sure what your end game is for your MOC, but I'd suggest looking at BrickController2 APP. It does have functions for setting a PU-L motor for 90degree rotations. I think you could adjust the parameters to meet your needs. Quote
JLiu15 Posted May 2, 2023 Author Posted May 2, 2023 On 4/28/2023 at 2:08 PM, TexasEngineer454 said: Not sure what your end game is for your MOC, but I'd suggest looking at BrickController2 APP. It does have functions for setting a PU-L motor for 90degree rotations. I think you could adjust the parameters to meet your needs. Expand I don't have a gaming controller. They're pretty expensive and I'd rather not spend the money on one right now. Also the Powered Up app does allow PU motors to make 90-degree rotations (or any degree). The issue I'm having right now is properly calibrating the motor to rotate to one of its endpoints. Steering servos check for the two endpoints and then rotate to the center position - the difference is that I need it to go to either of the two end positions rather than the center position. The 42131 and 42114 sets both do this with the gearbox motor. Again @kbalage made such a control profile in his review of the 42131 set where the press of a button shifts the gearbox into one of its end positions, and that's what I'm trying to achieve here. Right now I have it set to rotate -270 degrees to move it to an end position, but it just ends up stalling the gearbox motor for a while when it cannot make a full -270 degree rotation (e.g. if the gearbox position was at 0, 90, or 180 degrees earlier). Quote
vascolp Posted May 3, 2023 Posted May 3, 2023 Hi, If you have a lego remote controller you could try Remote Bla Bla. It includes several modes to control 90 degree steps gearboxes. Quote
Lok24 Posted May 3, 2023 Posted May 3, 2023 On 5/2/2023 at 9:17 PM, JLiu15 said: Steering servos check for the two endpoints and then rotate to the center position - the difference is that I need it to go to either of the two end positions rather than the center position. Expand 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 € ..... Quote
dr_spock Posted May 3, 2023 Posted May 3, 2023 Use a PU App math function block to compare the value of the button to the no press value. When no press condition true, then use a random block to select which end point the motor to go to. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.