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 / 541
540  |  542
Subject: 
Light sensor question
Newsgroups: 
lugnet.robotics.rcx.pbforth
Date: 
Mon, 15 Jul 2002 16:06:18 GMT
Viewed: 
2204 times
  
I want to expand the Scheme procedure

(get-light-value <sym | num>)

where <sym> is one of 'PORT1, 'PORT2, 'PORT3 and num is either 0, 1, or 2

to the FORTH code

128 <port> SENSOR_MODE
<port> SENSOR_CLEAR
<port> SENSOR_READ
<port> SENSOR_VALUE

So, if a user were to write something like

(cond
  [(> (get-light-value 'PORT2) 40) (do-something)]
  [(<= (get-light-value 'PORT2) 40) (do-something-else)])

it would execute the above FORTH code as it checked each condition. Do I
understand the way the light sensor works under pbForth correctly, or is
there something else I'd need to do to get at the value from the light
sensor? I only ask because my tests from the console are... inconclusive.

Thanks,

Matt

(A CC: on any replies would be appreciated!)



Message has 2 Replies:
  Re: Light sensor question
 
(...) With obvious mappings, of course. (...) Put another way, at no point does the red LED on the light sensor light up, and I consistently read the same value from the light sensor, regardless of whether I set the mode to RAW or percent value. In (...) (22 years ago, 15-Jul-02, to lugnet.robotics.rcx.pbforth)
  Re: Light sensor question
 
Hi Matt, I'll try to help. :o) First, you have to specify the type of sensor that is hooked on the port. You do that with: type port SENSOR_TYPE Let me know if you need to know the different values for 'type'. 3 is a light sensor. Ports are numbered (...) (22 years ago, 15-Jul-02, to lugnet.robotics.rcx.pbforth)

3 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR