To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.pbforthOpen lugnet.robotics.rcx.pbforth in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / pbFORTH / 26
25  |  27
Subject: 
Re: SENSOR_READ doesn't return 0
Newsgroups: 
lugnet.robotics.rcx.pbforth
Date: 
Tue, 13 Apr 1999 17:07:29 GMT
Reply-To: 
ROBOTS@JPSC.antispamCO.UK
Viewed: 
1717 times
  
More information:

I cannot get the LIGHT? word (tracker.txt) to work, it seems never to
return 0, usually 200 or 300 (hex). I am initialising using:

1 CONSTANT RawLight
1 CONSTANT RunButton
3 CONSTANT MotorStop

You have obviously had some FORTH experience, I'll have to admit I haven't
fully tested the CONSTANT word...

It hadn't occurred to me that ther might be something wrong with CONSTANT, but I
think the problem was there before. Making the sensor idx a constant was one of
the things I did to make sure that I didn't have an inconsistancy.

CONSTANT is working - easy to check by doing
RawLight .
which prints 1

: BOT_INIT

  ." BOT_INIT" CR \

  RCX_INIT
  POWER_INIT
  BUTTON_INIT
  SENSOR_INIT

    RawLight SENSOR_ACTIVE
  3 RawLight SENSOR_TYPE   ( Light )
  0 RawLight SENSOR_MODE   ( Raw )

This last line is the problem, if I use a SENSOR_MODE of 80 as in TRACKER.TXT then I
get a SENSOR_READ of 0, if I use SENSOR_MODE 0 then I never get a SENSOR_READ equal
to 0.

How does 80 in TRACKER.TXT square with the documentation?

"SENSOR_MODE ( mode idx -- )

Sets the specified sensor to one of the following modes. Use your common sense when
combining different modes and types...

0x0000 Raw mode
0x2000 Boolean mode
0x4000 Edge detection - every transition counts
0x6000 Pulse detection - only negative transitions count
0x8000 Percent of scale
0xA000 Degrees Celsius
0xC000 Degrees Fahrenheit
0xE000 Angle detection"

What I am trying is to recode the IR proximity detector that has appeared a few
times, this is my current NQC initialisation:

task ProximityDriver
// converted from code by Mark R. David        (markdavid@mediaone.net)
{
  Sensor(RAW_LIGHT, IN_CFG(STYPE_LIGHT, SMODE_RAW));
  IRMode(IR_HI);

How should I get a raw light reading?
--
John & James Cooper, Wallington, UK



Message has 1 Reply:
  RE: SENSOR_READ doesn't return 0
 
(...) OOPS, that SHOULD read 0x0080 since the mode is a BYTE value. Overzealous urge to get content into the website is to blame. For the light sensor, I generally use the percent of scale mode. My website has a page on tricks with the light sensor (...) (26 years ago, 15-Apr-99, to lugnet.robotics.rcx.pbforth)

Message is in Reply To:
  RE: SENSOR_READ doesn't return 0
 
(...) AhA! Another victim within my clutches!!!!! Glad to hear you are trying things out, John. The more questions I get, the sooner I can get a FAQ out to help with the common ones. (...) That's a good sign, at least. (...) You have obviously had (...) (26 years ago, 13-Apr-99, to lugnet.robotics.rcx.pbforth)

10 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