|
Page 1 of 1
|
[ 6 posts ] |
|
Robotc Varible motor with one button
| Author |
Message |
|
Casey890
Rookie
Joined: Mon Feb 27, 2012 5:26 pm Posts: 19
|
 Robotc Varible motor with one button
Hi trying to make a code for a ball launcher for a class assignment but have the issue of a high speed gear ratio stripping the tetrix dc motors. I have two motors on one port on sensor port one motor controller 3. The idea one hit of button 6 motor = 25 the 2nd hit will go to 50 the 3rd to 75 the 4th to a 100 and have button 7 do the same thing but slow it down so to make it go down -25 each hit to 0. I don't know much but I can provide a code that has the details.
|
| Tue May 29, 2012 2:28 pm |
|
 |
|
magicode
Moderator
Joined: Tue Sep 14, 2010 9:19 pm Posts: 495
|
 Re: Robotc Varible motor with one button
Here's some code for what you want to do: This is untested code, but it should give you an idea for what you want to do.
_________________ sudo rm -rf /
|
| Thu May 31, 2012 2:38 am |
|
 |
|
Casey890
Rookie
Joined: Mon Feb 27, 2012 5:26 pm Posts: 19
|
 Re: Robotc Varible motor with one button
hey would it be possible to do a motor power of 25 at 1 button press of button 7 and two presses at 7 = 100 motor power. and be able to do the same thing with button 6 in reverse? Thanks for the previous post that was very great for an untested code thank you.
|
| Thu Aug 16, 2012 7:37 pm |
|
 |
|
MHTS
Guru
Joined: Sun Nov 15, 2009 5:46 am Posts: 1023
|
 Re: Robotc Varible motor with one button
Magicode's code with slight modification: To do just 2 speeds, change NUM_SPEEDS to 3 and just initialize the array to contain only 0, 25 and 100.
|
| Thu Aug 16, 2012 9:02 pm |
|
 |
|
Casey890
Rookie
Joined: Mon Feb 27, 2012 5:26 pm Posts: 19
|
 Re: Robotc Varible motor with one button
I tried the code it is fantastic alone how ever I can't have it do tel-op with the rest of the robot is there anything I can do to help and thanks for everything.
|
| Thu Aug 30, 2012 3:01 pm |
|
 |
|
MHTS
Guru
Joined: Sun Nov 15, 2009 5:46 am Posts: 1023
|
 Re: Robotc Varible motor with one button
I assume when you said tele-op, you meant using a joystick to drive the robot around? If so, you can do this with the same code:
|
| Thu Aug 30, 2012 3:38 pm |
|
|
|
Page 1 of 1
|
[ 6 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 7 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|