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 / 23877
23876  |  23878
Subject: 
Re: sensor-defined variable
Newsgroups: 
lugnet.robotics
Date: 
Wed, 13 Apr 2005 12:34:07 GMT
Viewed: 
890 times
  
In lugnet.robotics, roc j de cisneros wrote:
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?

# Error: argument must be a constant
File "C:\DOCUME~1\jhansen\LOCALS~1\Temp\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
function requires a constant for the first parameter.  The result of SENSOR_1*10
has to be stored in a variable so the compiler will return an error for that
target in this situation.  If you use RCX2 as the target (or any brick type
other than RCX and Cybermaster) then PlayTone can take a variable for the first
parameter.

NOBODY SHOULD BE USING THE RCX TARGET ANYMORE!!!!! :-)

Regardless of the RCX brick you have if you download the 2.0 firmware to it then
you have an RCX2 brick and you should use that target when you compile your NQC
programs.  With the RCX2 firmware you have MANY more features available to you
in writing your NQC programs.

So in BricxCC be sure to pick RCX2 as your brick type (and set it as the default
brick type via the Preferences dialog).  If you use NQC via a command line you
should always add -TRCX2 to your compiler options.

John Hansen



Message is in Reply To:
  sensor-defined variable
 
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 (...) (19 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