Jump to content

Recommended Posts

Posted

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!

Posted

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. 

Posted
  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).

Posted
  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 € .....

 

Posted

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. 

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.
×
×
  • Create New...