To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 23876
23875  |  23877
Subject: 
sensor-defined variable
Newsgroups: 
lugnet.robotics
Date: 
Wed, 13 Apr 2005 11:32:14 GMT
Viewed: 
982 times
  
hi again
i tested your example, just to try, and i get compiler errors:;

PlayTone(SENSOR_1*10,5);
                   ^^

what's wrong with 10?
what am i missing?
thanks
r

task main()
{
   SetSensor(SENSOR_1,SENSOR_LIGHT);
   while(true)
   {
      PlayTone(SENSOR_1*10,5);
      Wait(5);
   }
}

Try it and see.

--
Brian Davis




Message has 2 Replies:
  Re: sensor-defined variable
 
(...) Nothing is wrong with 10, it was my assumption that was wrong. There are more than one version of the LEGO firmware, and it appears you have an older version that does not allow variable frequencies (the frequency must be a constant). Try (...) (20 years ago, 13-Apr-05, to lugnet.robotics)
  Re: sensor-defined variable
 
(...) # Error: argument must be a constant File "C:\DOCUME~1\jhansen...\temp.nqc" ; line 5 # PlayTone(SENSOR_1*10, 5); # ^^ #---...--- # 1 error during compilation If you use RCX as the target for compiling (or Cybermaster) then the PlayTone (...) (20 years ago, 13-Apr-05, to lugnet.robotics)

3 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