|
> Hi,
> is there any way to send IR messages using pbForth. This is in order to use
> the IR proximity detector commonly used with nqc programs.
> Also I think that with alternative firmware such as pbForth and nqc, it
> should be possible to do it without using the light sensor, just the IR com
> link.
> Thank you for your thoughts on the subject
YES!!! The standard FORTH word U. prints an insigned integer, while
EMIT sends out an arbitrary byte. So, for a simple IR proximity detector,
you would write something like:
HEX
0 SENSOR_ACTIVE (labelled sensor #1)
3 1 SENSOR_TYPE (light sensor )
80 0 SENSOR_MODE (in percent mode )
: LIGHT? ( sensor -- value )
BEGIN
DUP SENSOR_READ 0=
UNTIL
SENSOR_VALUE ;
: IR-TEST
BEGIN
FF EMIT ( Sends out the FF character )
1 LIGHT?
3002 SWAP 301F LCD_NUMBER LCD_REFRESH
BUTTON_GET 1 AND
UNTIL
;
This should work, its not tested. you might put a hard spin loop
after the EMIT to make sure the code is going out before sampling the
light sensor.
something like:
100 0 DO LOOP
should give you a delay. I'll provide some timing on the web site
soon!
Type IR-TEST to start sampling, the LCD should show the % reading
until you press RUN/STOP to stop the program.
Now, once you set a sensor for light, I think its RED (not IR)
LED comes on. You might want to block its output as described in
my page.
Can anyone confirm that the red LED is ALWAYS on? Can it be
shut off and will the sensor still work?
Thanks for trying pbFORTH!!!
Cheers,
Ralph Hempel - P.Eng
--------------------------------------------------------
Check out pbFORTH for LEGO Mindstorms at:
<http://www.bmts.com/~rhempel/lego/pbFORTH/default.html>
--------------------------------------------------------
Reply to: rhempel at bmts dot com
------------------------------------------------------
|
|
Message has 2 Replies: | | Re: Ir transmission
|
| (...) Perhaps EMIT? would do (...) I'm nearly done with my NQC to pbFORTH port of the IR proximity detector, but I'm stuck where I have at present got a 30ms delay (Sleep(3) in NQC). I expect it isn't critical but the current detector works so well (...) (26 years ago, 14-Apr-99, to lugnet.robotics.rcx.pbforth)
| | | Re: Ir transmission
|
| (...) I can't get EMIT to work, in NQC I do this: SendMessage(255); // Flash Sleep(3); ThisRaw = RAW_LIGHT; and the raw light sensor reading has big spikes for IR reflections. but: [ HEX ] FF EMIT 30 msWait RawLight LIGHT? does not, I think that (...) (26 years ago, 10-May-99, to lugnet.robotics.rcx.pbforth)
|
Message is in Reply To:
| | Ir transmission
|
| Hi, is there any way to send IR messages using pbForth. This is in order to use the IR proximity detector commonly used with nqc programs. Also I think that with alternative firmware such as pbForth and nqc, it should be possible to do it without (...) (26 years ago, 29-Mar-99, to lugnet.robotics.rcx.pbforth)
|
9 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
|
|
|
|