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 / 551
550  |  552
Subject: 
RE: Lazy newbieish question
Newsgroups: 
lugnet.robotics.rcx.pbforth
Date: 
Wed, 17 Jul 2002 23:37:47 GMT
Reply-To: 
<RHEMPEL@BMTS.stopspammersCOM>
Viewed: 
2875 times
  
We're wrapping a lot sensor input stuff at a higher level of abstraction
than the raw pbForth words. This makes sense; a Forther would probably do
the same. For example, we're providing

(get-light-value 'PORT2)

expands to

3 1 SENSOR_TYPE
128 1 SENSOR_MODE
1 SENSOR_CLEAR
1 SENSOR_READ DUMP
1 SENSOR_VALUE

effectively. Perhaps this is a bit much every time the programmer checks the
light sensor, but that's what our initial compilation process converts the
abstraction into.

Matt,

I see this all the time when I teach embedded C programming to desktop
guys - it's an objectification of things at the wrong level.

Maybe you could consider this:

  (setup-light-sensor 'PORT2)

  which expands to

  3 1 SENSOR_TYPE
  128 1 SENSOR_MODE
  1 SENSOR_CLEAR

and then

  (get-light-value 'PORT2)

  which expands to

  1 SENSOR_READ DROP
  1 SENSOR_VALUE

Becasue you are dealing with real hardware, it takes a while between setting
up a light sensor and actually reading it. You are probably clearing the
sensor every time and never getting a valid result, becuase it's 3 msec
between samples!

I'll ignore the rest of the post until I convince you that this is
the better way to do things :-)

Cheers, Ralph



Message is in Reply To:
  Lazy newbieish question
 
If I wasn't in a hurry with so many things to do in the next two days, I would figure this out for myself. My apologies for such a simple question. We're wrapping a lot sensor input stuff at a higher level of abstraction than the raw pbForth words. (...) (22 years ago, 17-Jul-02, to lugnet.robotics.rcx.pbforth)

2 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