To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.scoutOpen lugnet.robotics.scout in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Scout / 120
119  |  121
Subject: 
Re: Scout and External Iight sensor question
Newsgroups: 
lugnet.robotics.scout
Date: 
Sat, 20 Jan 2001 19:21:54 GMT
Viewed: 
2161 times
  
DJA wrote:

Hi all,

I read once that it is possible to use an external light sensor on on of the
2 available input ports on the SCOUT in RAW mode.  I attempted to do this
with SENSOR_1 in NQC with little success.

Here is what I have tried.

SetSensorType(SENSOR_1, SENSOR_LIGHT);
SetSensorMode(SENSOR_1, SENSOR_MODE_RAW);

On first try - got an error SENSOR_LIGHT variable undefined...
Then I commented out the first line and hoped that by setting SENSOR_1 to
RAW, the SCOUT could interpret the values correctly...

I built a calibrate function that would calibrate the light values and play
a sound based on the light value.

Here is part of the code:

i = 0;
  runningTotal = 0;
  while (i < 10)
  {
runningTotal += SENSOR_1;
    Wait(50); // .5 sec
    i += 1;
    if (c == 0)   // calibrate  black
    {
      blackthresh = runningTotal / 10;
      PlayTone(blackthresh , 10
}
(note there may be { placement errors as some code has been clipped.)

When the program runs it will loop through 10 iterations, sample the light
and play a sound based on the light value.  I get no sound... The variable
blackthresh is evaluating to 0.  So to verify that the PlayTone is working,
I add 100 to blackthresh:
PlayTone(whitethresh + 100, 10)
This gives me a consistent sound for each of the 10 iterations of the light
calibration procedure..  What I get from this is that the SCOUT is not
reding the light sensor values in RAW.

Any suggestions / ideas would be appreciated.

Thx,

Dave

Scout has a special command for RAW.

Sensor ValueRaw(n);

x = SensorValueRaw(0);

This is taken from page 28 of the NQC manual.

Hope that helps.

Dean
--
Coin-Op's For Sale!: http://www.akasa.bc.ca/tfm/coin-op.html
Dean's Lego Workshop: http://www.akasa.bc.ca/tfm/lego_wr.html
Vancouver Lego Club: http://www.akasa.bc.ca/vlc



Message is in Reply To:
  Scout and External Iight sensor question
 
Hi all, I read once that it is possible to use an external light sensor on on of the 2 available input ports on the SCOUT in RAW mode. I attempted to do this with SENSOR_1 in NQC with little success. Here is what I have tried. (...) (24 years ago, 20-Jan-01, to lugnet.robotics.scout)

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