View unanswered posts | View active topics It is currently Wed Aug 05, 2020 4:48 am

 Page 1 of 1 [ 2 posts ]
 Print view Previous topic | Next topic
prioritizing and remembering
Author Message
Rookie

Joined: Sat Apr 06, 2013 6:20 pm
Posts: 1
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
Rookie

Joined: Tue Jul 26, 2011 8:19 pm
Posts: 15
Re: prioritizing and remembering
 tylertnooo wrote:For Vex CortexIs 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
Display posts from previous:  Sort by
 Page 1 of 1 [ 2 posts ]

Who is online

Users browsing this forum: No registered users and 1 guest

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ ROBOTC Applications    ROBOTC for LEGO MINDSTORMS       Third-party sensors    ROBOTC for CORTEX & PIC    ROBOTC for VEX IQ    ROBOTC for Arduino    Robot Virtual Worlds    Multi-Robot Communications    Issues and Bugs Competitions & Partners    Mini Urban Challenge    CS2N Robot Virtual Worlds Competitions       VEX Skyrise Competition 2014-2015       VEX Toss Up 2013-2014       FTC Block Party! 2013-2014    Competitions using VEX - BEST, TSA, VEX, and RoboFest!    FTC Programming    RoboCup Junior and Other ROBOT Competitions Virtual Brick Robotics Discussions    General Discussions    Project Discussions Off-Topic ROBOTC Forum & ROBOTC.net Suggestions/Feedback    ROBOTC Forums Suggestions/Comments    ROBOTC.net Suggestions/Comments       NXT Programming: Tips for Beginning with ROBOTC       VEX Programming: Tips for Beginning with ROBOTC    2013 Robotics Summer Of Learning       VEX Toss Up Programming Challenge       FTC Ring It Up! Programming Challenge    International Forums       Spanish Forums          ROBOTC for MINDSTORMS          ROBOTC for VEX       French Forums          ROBOTC pour Mindstorms          ROBOTC pour IFI VEX       Japanese Forums （日本語のフォーラム）       German Forums    2015 Spring Carnival Event    PLTW (Project Lead The Way)    Robotics Merit Badge    2014 Robotics Academy Summer of Learning