To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.nqcOpen lugnet.robotics.rcx.nqc in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / NQC / 64
63  |  65
Subject: 
Re: two task and while true
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Fri, 7 May 1999 14:13:25 GMT
Viewed: 
2427 times
  
In lugnet.robotics.rcx.nqc, Stefan Prescher writes:
Hi
I made a small programm

task main
if IN_3 ==1
start wb
else
stop wb

task sb
while (true)
if () fwd(Out_a,7);

I found out that the prgramms goes into the while loop but it never started
the motor
if I copied it into the main part it runs fine

Is that correct?


Hmm:

- I believe that, after main starts, unless you press IN_3 *very*
  quickly, that IN_3 will not be 1, hence stop wb will be chosen.
  Perhaps you want something like this? :

task main {
  while (true) {
    wait(IN_3 == 1);
    // start motor
    wait(IN_3 == 0);
    // stop motor
  }
}



Message is in Reply To:
  two task and while true
 
Hi I made a small programm task main if IN_3 ==1 start wb else stop wb task sb while (true) if () fwd(Out_a,7); I found out that the prgramms goes into the while loop but it never started the motor if I copied it into the main part it runs fine Is (...) (26 years ago, 2-May-99, to lugnet.robotics.rcx.nqc)

2 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR