So in my class we had to choose from a bunch of different options (won't go into detail) but my partner and I decided to go with a 'cookie maker'/ elevator. We are using 1 motor, 1 sonar, 2 bump switches, and 3 servos. The motor will operate the elevator, the sonar will let us tell the elevator when to stop, 1 bump switch will start the program, the other will be an 'emergency' stop & start, and the 3 servos will release a 'cookie' at the top, a 'chocolate chip' in the middle and then push them both off at the bottom. My main concern is that this is going to be impossible somehow but i am hoping that someone can help me with this or just give me some direction for my coding.

On top of that the emergency stop/start has to be pressed to stop everything and then pressed again to start the program from where it was, or at least that is what my teacher wants.

*Edit*I'm not doing this to cheat i just really need help and my teacher only started teaching this stuff this year. So any advice on how i could get some of this to work would be much appreciated!

Tue Mar 12, 2013 11:09 am

Coder A

Moderator

Joined: Thu Jan 03, 2013 5:10 pmPosts: 202Location: The plateau north of the Ohio River Valley, also known as Cave Country.

Re: New Programmer: Need help please!

I trust that you won't cheat, but still be aware that none of us will help you until you have some test code or questions. We can not tell you what to do with much detail at this point. Could you give some specific questions?

I will try to help!

_________________I'm not a robot! I'm british! ~ quote from an asparagusI am not a robot! I am a unicorn! ~ quote from a robot

Wed Mar 13, 2013 7:43 pm

Harmee

Rookie

Joined: Tue Mar 12, 2013 10:54 amPosts: 7

Re: New Programmer: Need help please!

I will be posting my code and some questions i have later today But one of the big things i don't know how to do at all is the emergency stop WITH the start. So if it is pressed everything is stopped but when it is pressed again it all starts back up from the point it stopped. Is this even possible?

Thu Mar 14, 2013 8:28 am

Harmee

Rookie

Joined: Tue Mar 12, 2013 10:54 amPosts: 7

Re: New Programmer: Need help please!

So here is what i have. *NOTE* The numbers are not actually what i want them to be, measurements are still being done. As for the code, i want the elevator to start at the top and then a servo will push for flick or something the cookie onto the platform, which will then go down to the next level where it will wait for a Chocolate Chip to be pushed onto the cookie, it will then go to the bottom where it is hit off into a bin. After all of that it will return to the top where the process will be done again into there are no cookies left.

Joined: Thu Jan 03, 2013 5:10 pmPosts: 202Location: The plateau north of the Ohio River Valley, also known as Cave Country.

Re: New Programmer: Need help please!

I would say the best way to do the emergency stop is to start a new task that runs a loop until the em. button is pressed, and then hogs the cpu, with hogCPU(). Then it runs a second loop until the button is pressed again, then releasing the CPU with releaseCPU().

As for the rest of the code, tell me if this is accurate psuedo-code (fake code):1.wait for button to be pressed.2.push cookie into elevator.3.go to floor 2.4.push chip into elevator.5.go to floor 1.6.push cookie & chip out.7.go to floor 3.8.repeat steps 2 through 6 until there are no cookies left.

Are hogCPU() and releaseCPU() supported on VEX? You see, I actually do not have a VEX, I have an NXT, so I can only help with code structure, not actual commands.

Do you have any more questions?

_________________I'm not a robot! I'm british! ~ quote from an asparagusI am not a robot! I am a unicorn! ~ quote from a robot

Fri Mar 15, 2013 9:48 am

Harmee

Rookie

Joined: Tue Mar 12, 2013 10:54 amPosts: 7

Re: New Programmer: Need help please!

I think that the hogCPU() and releaseCPU() are supported. As for the other stuff that is the just of the program. However the two different codes i wrote weren't working. The code wouldn't recognize the sonar and would go on forever.

Fri Mar 15, 2013 10:02 am

Harmee

Rookie

Joined: Tue Mar 12, 2013 10:54 amPosts: 7

Re: New Programmer: Need help please!

Actually after i changed my sonars i had the numbers and the name of the sonar in the wrong order. The only problem with the first code is that after it is done it goes back to the top but does not stop. Everything else seemed to work.

Fri Mar 15, 2013 3:15 pm

Coder A

Moderator

Joined: Thu Jan 03, 2013 5:10 pmPosts: 202Location: The plateau north of the Ohio River Valley, also known as Cave Country.

Re: New Programmer: Need help please!

Could you put your code in the code tags( [ code] [ /code] with no spaces)?

_________________I'm not a robot! I'm british! ~ quote from an asparagusI am not a robot! I am a unicorn! ~ quote from a robot

Who is online

Users browsing this forum: No registered users and 2 guests

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