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 / 176
175  |  177
Subject: 
Re: About SensorValueRaw(SENSOR_3) in Scout
Newsgroups: 
lugnet.robotics.scout
Date: 
Wed, 18 Jul 2001 02:32:39 GMT
Viewed: 
3031 times
  
In article <GGHBtM.FGp@lugnet.com>, "Zhengrong Zang"
<legozang@yahoo.com> wrote:

I tried to get raw value of sensors in Scout, the SensorValueRaw(0/1) is
ok, I
get the raw values of Sensor1 and Sensor2, but I found SensorValueRaw(2)
doesn't work, no value is returned.
Then I found a example in NQC Guide Version 2.3 r1, it is
SensorValueRaw(SENSOR_3), but it can't be compiled, I found SENSOR_3 is
defined
SensorValue(2) in rcx2.nqh.
How can I read raw value of light sensor in Scout?


I think SensorValueRaw(2) should do what you want.  I wrote a little
test program:

----

int x, y;

task main()
{
   y = 0;

   while(true) {

      x = SensorValueRaw(2);
      if (x > (y + 10))
         PlaySound(SOUND_CLICK);
      y = x;
   }
}

----

and it seems to click a lot as things get brighter, and stop clicking as
things get darker.  If SensorValueRaw(2) isn't behaving as you expect,
let me know.

SensorValueRaw(SENSOR_3) won't compile any more - my bad.  I reworked a
lot of the expression code for 2.3 and guess I broke this (it was quite
a hack in the first place to allow SENSOR_3 to mean either the value of
sensor three or the index of sensor three depending on the context in
which it was used).  You should see the same problem with the other
SensorXXX values.  I'll try to fix this for the next release.

Dave Baum

--
reply to: dbaum at enteract dot com



Message has 1 Reply:
  Re: About SensorValueRaw(SENSOR_3) in Scout
 
You are right! I got the raw value of light sensor by SensorValueRaw(2) in Scout. By the way, I found the max raw value of Touch sensor is 255 in Scout, not 1023. Zhengrong (...) (23 years ago, 18-Jul-01, to lugnet.robotics.scout)

Message is in Reply To:
  About SensorValueRaw(SENSOR_3) in Scout
 
I tried to get raw value of sensors in Scout, the SensorValueRaw(0/1) is ok, I get the raw values of Sensor1 and Sensor2, but I found SensorValueRaw(2) doesn't work, no value is returned. Then I found a example in NQC Guide Version 2.3 r1, it is (...) (23 years ago, 14-Jul-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

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR