To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.javaOpen lugnet.robotics.rcx.java in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / Java / 131
130  |  132
Subject: 
Re: Light sensor initialization time?
Newsgroups: 
lugnet.robotics.rcx.java
Date: 
Thu, 27 Sep 2001 20:52:56 GMT
Viewed: 
2836 times
  
I suspect this is due to the fact that the first
sample from the sensor is actually being obtained
while the sensor's reservoir capacitor is still charging.

Why don't you try a simple test, actually two tests;

1.

Initialise as passive sensor
Wait 1 second
Run your code

2.

Initialise as active sensor
Wait 1 second
Run your code

You may find that the results will differ
because the sensor has already settled down
in the second case, but will still be charging
in the first case.

JB



In lugnet.robotics.rcx.java, Martin Egholm Nielsen writes:
Hellow!

Here a little fact: the first reading on the light sensor
_just_ after you have activated it is too high. It seems
like one has to wait a little after activating the sensor.
The following program shows it rather nicely:
____START OF CODE____
import josx.platform.rcx.*;

public final class WeirdLight implements SensorConstants {

   public static void main( String[] args ) {
Sensor.S2.setTypeAndMode( SENSOR_TYPE_LIGHT,
SENSOR_MODE_PCT );
Sensor.S2.activate();

// Uncomment the following to make it behave as expected
//try { Thread.sleep( 500 ); } catch ( Exception e ) {}

int val = Sensor.S2.readValue();

LCD.showNumber( val );
try { Thread.sleep( 1500 ); } catch ( Exception e ) {}

Sensor.S2.passivate();
   } // main
} // WeirdLight
____END OF CODE____

If you include the first sleep command the value is as
expected.
When I ran the program I got the following results: 79-80
_without_ the sleep, and 33-35 (black tape) with the sleep.

Regards,
Martin E. Nielsen



Message has 1 Reply:
  Re: Light sensor initialization time?
 
Hi, (...) Well, I considered that, but I wondered why the measurement is so high then? Regards, Martin E. Nielsen (...) ___CODE CUT AWAY___ (...) (23 years ago, 28-Sep-01, to lugnet.robotics.rcx.java)

Message is in Reply To:
  Light sensor initialization time?
 
Hellow! Here a little fact: the first reading on the light sensor _just_ after you have activated it is too high. It seems like one has to wait a little after activating the sensor. The following program shows it rather nicely: ____START OF CODE____ (...) (23 years ago, 27-Sep-01, to lugnet.robotics.rcx.java)

3 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