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 / 943
942  |  944
Subject: 
Error in program
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Wed, 31 Jan 2001 15:25:04 GMT
Reply-To: 
ash@jadzia-dax.deSPAMLESS
Viewed: 
2031 times
  
Hi,
can somebody tell me why this little program doesn't give any output? It
just keeps running and doing nothing...

int Edges[7], CounterLength=0;
task main(){
  SetSensor (SENSOR_2, SENSOR_TOUCH);
  until(CounterLength == 8){
   Edges[CounterLength] = (CounterLength + 1);
   ++CounterLength;}

   CounterLength = 0;
   until(CounterLength == 8){
   repeat(Edges[CounterLength]){
    PlayTone(440,25);
    Wait(35);}
   PlayTone(220,25);
   Wait(35);
   until(SENSOR_2 == 1);
   ++CounterLength;}}
--
TIE: Andi S.



Message has 2 Replies:
  Re: Error in program
 
Well I am just a newbie to NQC and to the whole Mindstorm experience, however here is what the compiler says when I try to compile the program that you submitted. Line 1: Error: RCX does not support Arrays I hope that this helps. Chris (...) (24 years ago, 1-Feb-01, to lugnet.robotics.rcx.nqc)
  Re: Error in program
 
(...) Your array is too small, it runs from 0 to 6. Maybe you should also put a CounterLength = 0; before the first until. until(SENSOR_2 == 1); makes it wait for the sensor being pressed. Also, as a matter of style, I'd rather use (...) (24 years ago, 1-Feb-01, to lugnet.robotics.rcx.nqc)

5 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