Subject:
|
Re: IR Port as Proximity detector.
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Fri, 8 Jan 1999 17:26:18 GMT
|
Reply-To:
|
nospam-dcchen@#NoSpam#pacbell.net-nospam
|
Viewed:
|
1779 times
|
| |
| |
Michael Gasperi wrote:
> > SendMessage(level);
>
> You are only making IR light with the transmitter, why do you send the value of
> level? Why not just a constant?
Agreed, I could have sent OhFF or any number for that matter. Sending
the read light level was a legacy of my early debugging code in which I
was using RcxCC's live monitoring feature to see what values were being
read to establish my threshold value. I found that w/ a 100% Transmit
duty cycle, it would wash out any attempts to communicate with the
tower.
Instead, I defined a constant and had the test program beep when it
exceeded the theshold. The old code never changed.
I am going to try Simen Svale Skogsrud's (the originator that I know of
of this idea) idea of checking for large jumps in absolute values. Also
will try a smaller duty cycle, let's say 5-10% to save on battery life
and to allow for IR Tower incoming transmissions.
Maybe
#define THRESHOLD 100
int level;
int oldlevel;
task Ping
{
while(true)
{
repeat(10)
{
level = IN_2; Or whatever sensor your light monitor is.
if(abs(level1,oldlevel) > THRESHOLD)
{
/*do what ever collision routine you want to do
}
oldlevel = level;
}
sleep(400);
}
}
Have to figure how many bytecodes I use inside the repeat() loop and
adjust the 10 and 400 numbers accordingly to set a particular duty
cycle. Or just wing it and see...
Dave Chen
|
|
Message is in Reply To:
13 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|