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 / 964
963  |  965
Subject: 
Q: Multitasking, and reacting to sensors
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Mon, 5 Feb 2001 18:07:20 GMT
Reply-To: 
tobias.moller@telia.com/avoidspam/
Viewed: 
2108 times
  
I've downloaded NQC, and got it running. I have been able to make the
motors run, to make them run backwards, then forward, etc.

However...

I can't get the sensor thing to work right. I want to make a program for
a robot that backs up and turns when it hits a wall. In RCX code I'd use
a sensor block.

In NQC, I've tried to use the "If" statement, but it doesn't work
correctly... It doesn't react to the sensor!

Does this kind of procedure need to involve multitasking to work right?
I put the if statement inside task main{} or whatever it's called.

Should I instead make one task main, where I run the motors, and one
task bump or something, where I put the if statement?

This leads me to the second question...
Although I already may have the answer...
Could someone give me a simple example of multitasking? I've read the
documentation, I know what it does, I just don't know how to use it.

Can I define a task in the beginning of the program, then run it only
under certain circumstances (like light reading <50), or at a certain
point in the program?

Any help appreciated.

--Tobias



Message has 3 Replies:
  Re: Q: Multitasking, and reacting to sensors
 
(...) Did you define the sonsors correctly ? For example : #define BUTTON SENSOR_2 #define DETECT_LEFT SENSOR_1 #define DETECT_RIGHT SENSOR_3 #define MOTOR_LEFT OUT_A #define MOTOR_RIGHT OUT_C task main() { SetSensor(BUTTON, SENSOR_TOUCH); (...) (24 years ago, 5-Feb-01, to lugnet.robotics.rcx.nqc)
  Re: Q: Multitasking, and reacting to sensors
 
Tobias, 'multi-tasking' means that several tasks run simultaneously. For example, a robot arm could grab, lift and swivel, one after the other, as functions, or simultaneously, as tasks. Or, the RCX could play a tune and a walker could walk, one (...) (24 years ago, 5-Feb-01, to lugnet.robotics.rcx.nqc)
  Re: Q: Multitasking, and reacting to sensors
 
Hej Tobias! (...) No, rather you need a While or Until loop. Normal programming languages are different from the RCX code. In RCX code the watchers are running all the time, in NQC you need to program the repetition yourself. A program for simple (...) (24 years ago, 6-Feb-01, to lugnet.robotics.rcx.nqc)

9 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