School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 307,035 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,266 people online right now. Registration is fast and FREE... Join Now!




Microwave

 

Microwave, I cant make my microwave stop cooking!!

randomdane

14 Oct, 2009 - 12:25 AM
Post #1

New D.I.C Head
*

Joined: 4 Oct, 2009
Posts: 8

Hi, for my uni lab this week(I don't want you to do it, I just need help!!) we have to program a "microwave"(NXT) robot with a Lego microwave..

My microwave spins but wont stop after the time its supposed to..

The language I have to use is MaSH, which i have tried to explain in another thread, but for easyness here is the link to the webpage with the documentation for it...(moderators didn't say anything about anyone else posting the address)--http://www.cit.gu.edu.au/~arock/--thats the creators home page, Dr Andrew Rock.

here is a video of what its supposed to do : http://www.youtube.com/watch?v=t4ueI1o67Xk

here is my code:

CODE


/*
****micro.mash
**** simulates a microwave
**** Dane callaghan
*/

import nxt;

final int START = 1;
final int LATCH = 2;



int n = 0;

void main(){
   setUpSensor(START, TOUCH);
   setUpSensor(LATCH, TOUCH);
   start1();
   waitForPush(START);
   while(true)  {
   if(n > 0)   {
   motorForward(A,50);
   sleep(100);
   n= n-10;
   } else {
   }
}
}

void run1(){
   while(n==0 || n>0)  {
   waitForPush(START);
   n=n+50;
   }
  
}


Yeah so it spins the "turntable" but wont stop.. Any idea's?

I also have to make a lamp come on when the door is open or when the microwave is "cooking" and display how much time is left on the NXT itself as well..but for starters I just have to make it spin for 5 secs when the button is pressed, whether the door is open or not. I would like to know how to do the rest too. I know have to have code that turns the light on if the touch sensor is not pushed or the motor is spinning but dont know how to code it.

And I havent got a clue how to make the remaining seconds appear on the NXT screen..


Any help would be greatly appreciated

Dane

User is offlineProfile CardPM
+Quote Post


mostyfriedman

RE: Microwave

14 Oct, 2009 - 01:47 PM
Post #2

Striving Student
Group Icon

Joined: 24 Oct, 2008
Posts: 3,212



Thanked: 357 times
Dream Kudos: 600
Expert In: Learning

My Contributions
what is this doing in the functional programming forum
User is online!Profile CardPM
+Quote Post

randomdane

RE: Microwave

14 Oct, 2009 - 11:06 PM
Post #3

New D.I.C Head
*

Joined: 4 Oct, 2009
Posts: 8

QUOTE(mostyfriedman @ 14 Oct, 2009 - 01:47 PM) *

what is this doing in the functional programming forum


Its waiting for some one who thinks its in the wrong forum to tell the author which forum they think it should be in. And why.
User is offlineProfile CardPM
+Quote Post

olibenu

RE: Microwave

15 Oct, 2009 - 12:14 AM
Post #4

D.I.C Regular
Group Icon

Joined: 31 Dec, 2008
Posts: 269



Thanked: 15 times
Dream Kudos: 350
My Contributions
cool. we'd have to learn mash first. from the link i see it's like java. maybe the java boys can help
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 08:44AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month