|
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
|
|
|
|