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=t4ueI1o67Xkhere 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