The two motors on my pivot weren’t able to lift up the bar. So I believed my robot had problems with power because I had 8/10 motors programmed and powered.
When I removed all the programming of the motors except for the two motors on the pivot, it worked flawlessly, but it just doesn’t lift even when all the motors are unplugged (but all motors are programmed).
I thought that the power expander could be a solution to the problem, so I specifically wired the two motors on the pivot to the power expander and tried it again, to no avail.
I don’t really understand the problem, because my programming seems fine and wiring is all done well. I thought the power expander could harness one whole battery’s power to just those two motors, but apparently not.
My robot has a competition this weekend, so I’m in a rush to try and figure this out.
Motors 8 and 9 work together as the pivot for my lift. Channel 6 is what I would like to use for motors 8 and 9.
Motor 7 is my forklift, which sits on the lift bar. It is the same function as a pivot. Channel 5 is what I would like to use for motor 7.
Motor 10 is my claw. Channel 7 UP and DOWN is what I would like to use for motor 10.
Now, since the lift and forklift themselves are both quite heavy, I tried to program the individual buttons on channel 8 of the digital joystick (U8, D8, R8) with motor rotations against the falling speed, “locking” the lift/forklift in place.
For U8 I would like to “lock” motors 8 and 9 (the pivot).
For D8 I would like to “lock” motor 7 (the forklift).
For R8 I would like a combination of both the functions of U8 and D8, “locking” all motors 7, 8, and 9.
Just one last thing. The way you are locking the motors is not great. Currently you send them -30 and 30 or -40 and 40 at the same time which is very bad for the motors. To make the motors not move you just send them 0 power. Jpearman will come rewrite most of your code from scratch using this format
if(criteria){
stuff to do
}else if(other criteria){
other stuff to do
}
I just wanted to clarify what some of the problems were for when you try to write some more of your own code.
So I assume that what you mean by “locking” the motors is that you do not want them to move in response to gravity or perhaps holding some weight. We can do this by sending a small amount of power to them, usually you want this to be as small as possible and in any event no larger than perhaps a value of 25, otherwise you will trip the internal PTC current and overheat protection circuit very quickly.
Here is some code that shows the general approach.
When no button is held down then you control the motors with the joystick, when holding the lock button then a fixed value is sent.
Btn8U etc. are variables defined in the variables dialog as type int.
I didn’t add any of the holo drive code, I may have the motor directions reversed, you need to check and experiment with that if necessary.
It had a similar issue to the code in this post (although this one is about ROBOTC code). Stop your motors jittering
for example,
you call the function
JoystickDigitalToMotor( 1, 6, 1, 100, 2, -100, 8 )
this uses button 6 up and down to control motor 8.
then later in the code you call this function.
JoystickDigitalToMotor( 1, 8, 2, -30, 2, 30, 8 )
this uses button 8 up to also control motor 8, unfortunately it tries to send both -30 and 30 at the same time to the motor, not sure why EasyC even allowed this statement as it doesn’t make much sense.
You also have a third place trying to send more control values to motor 8 based on button 8 right.
You were thinking along the right lines by using “ButtonValue” to read the state of the button to lock the motors, however, you needed to make a decision based on this value after setting it.