Subject:
|
Re: table brickos light to percent
|
Newsgroups:
|
lugnet.robotics.rcx.legos
|
Date:
|
Thu, 27 May 2004 18:54:47 GMT
|
Viewed:
|
5694 times
|
| |
| |
In my opinion, the best way to approach this is the following:
When the program starts, begin a Calibration, by first activating the
light sensor, then reading the value. You can either wait a specific
amount of time or have the user press a button to continue.
During the calibration, you can measure and record the lowest and
highest light sensor readings. Then for the duration of the program use
the following calculation:
percent = (current - lowest) / (highest - lowest);
At the exit of the calibration routine, you may want to ensure that
highest != lowest to be safe.
Also, during normal operation, you could always update the lowest and
highest if the current is lower or higher respectively.
For an adaptive process, you could have the high and low decay toward
each other over a period of a few minutes. Then adjust the high and low
if the current exceeds the their values. This way, the program could
adapt to changes in input conditions (for instance, on a partly cloudy
day, sometimes the sun will be shining, others it will not)
I hope this is helpful.
// Joe
(to answer your question more directly, no, I don't think there is a
table built into BrickOS that will do what you asked)
Thomas Jollans wrote:
> i there a table or converter from brickos light readings to light
> percentage ( and vice versa )
>
> Thomas
|
|
Message is in Reply To:
3 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|