View unanswered posts | View active topics It is currently Tue Sep 22, 2020 9:36 pm

Reply to topic  [ 1 post ] 
Seeking Sample Code To Use Encoder to Limit Arm Movement 
Author Message

Joined: Thu May 19, 2016 5:24 pm
Posts: 1
Post Seeking Sample Code To Use Encoder to Limit Arm Movement
I am a mentor for an FTC team in the Los Angeles region. With the switch to Android/Java this past season, we have NXTs and HiTechnic controllers that aren't being used so we created a pair of demonstration bots to take to schools and public events where we want to let children drive them. Each bot has a scoop on it powered by an AndyMark 40 motor to raise and lower it. We programmed the arm to raise and lower from the 0 and 4 buttons on the controller hat which works fine, but we did an outreach event last weekend and found that kids would hold down the buttons unknowingly and try to drive the mechanism past the mechanical limits, damaging it.

I theorize it should be possible to use the AndyMark built-in encoder to control the motor by treating it like a servo and running the motor to a specific encoder value. What we would like to do is have the hat button act as a toggle where a press on "up" would cause the motor to bring the scoop to a preset raised position and no further, and then a press on "down" would return it to the lowered position each time. This way the scoop would only have two defined positions, and could not be pushed past the stops to cause damage.

I hope some of you might have addressed this problem before in RobotC and might be willing to share your code with us. Our team does not have a lot of programming strength, and what we have is in Java, not RobotC. If we were trying to do this in Java I would have the team figure it out for themselves but since we aren't using RobotC in competition any more I'd rather have them spend their time on other things.

Thanks in advance for any help or suggestions you might have.

Brian Johnson

Thu May 19, 2016 5:46 pm
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 2 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

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.