View unanswered posts | View active topics It is currently Sat Apr 19, 2014 12:21 am






Reply to topic  [ 2 posts ] 
prioritizing and remembering 
Author Message
Rookie

Joined: Sat Apr 06, 2013 6:20 pm
Posts: 1
Post prioritizing and remembering
For Vex Cortex

Is there any way to prioritize and remember button being pushed?

Example:
I was in an elevator and I push button 1, somebody else steps in an pushes button 2. Another person steps in and pushes button 3.

button 1= floor 1, button 2= floor 2, etc. . .


Is there any way that I could have the cortex remember the order those buttons are pushed and perform the functions associated with those buttons?

Also is there a way that I could have the cortex preform the tasks so that they are operating in the most efficient way possible.

Example:

The elevator was on floor 4 so it will go to floor 3, then 2, then 1.


Sat Apr 06, 2013 6:37 pm
Profile
Rookie

Joined: Tue Jul 26, 2011 8:19 pm
Posts: 15
Post Re: prioritizing and remembering
tylertnooo wrote:
For Vex Cortex

Is there any way to prioritize and remember button being pushed?

Example:
I was in an elevator and I push button 1, somebody else steps in an pushes button 2. Another person steps in and pushes button 3.

button 1= floor 1, button 2= floor 2, etc. . .


Is there any way that I could have the cortex remember the order those buttons are pushed and perform the functions associated with those buttons?

Also is there a way that I could have the cortex preform the tasks so that they are operating in the most efficient way possible.

Example:

The elevator was on floor 4 so it will go to floor 3, then 2, then 1.


For the first issue, you can use an array and store the buttons as they are pressed. Here is a good website for learning about arrays: http://robodesigners.blogspot.com/2012/04/arrays-in-robotc.html

For the second issue, you can sort the array right before you proceed to a floor. There are a lot of programming techniques for sorting, the easiest of which would be http://en.wikipedia.org/wiki/Selection_sort. It is not the most efficient way of handling it but it would work. It would be problematic if you are above the lowest floor set, though, as it would travel all the way to the bottom before proceeding back up. I would handle this by putting the current level in an array with all of the values higher than it (sorted from the lowest, which should be the current floor, up to the highest) and creating another array with all of the lower values (sorted from the lowest floor up to the closest floor to the current one). This may not be the most efficient way to solve the problem, though.

_________________
Member of the Sarah Heinz House VEX and FIRST teams.


Sat Apr 06, 2013 8:23 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

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.