Subject:
|
Re: Sensor Commands and legOS 0.2.3
|
Newsgroups:
|
lugnet.robotics.rcx.legos
|
Date:
|
Tue, 24 Apr 2001 21:48:15 GMT
|
Viewed:
|
1671 times
|
| |
| |
Doug Herbert <herbertd@purdue.edu> writes:
> I just installed legOS 0.2.3 under Redhat 6.2, using the RPM's that were
> linked to in the HOWTO. Everything I have tried so far has worked great,
> except for getting my touch sensors to work. The documentation I have
> read said that in 0.2.x one could just use TOUCH_1 and the variable
> would already be decared and ready for use. I have tried this, and it
> comes back as an undeclared variable. I have made sure that I have
> included dsensor.h, but a visual inspection of the header file showed no
> reference to this variable. My question is, how do I make this work, and
> does anybody know of any good documentation for basic touch sensors.
TOUCH_1 is a macro defined in dsensor.h starting form version 0.2.4. If
you don't want to upgrade, here is the code:
#define TOUCH(a) ((unsigned int)(a) < 0x8000)
#define TOUCH_1 TOUCH(SENSOR_1)
#define TOUCH_2 TOUCH(SENSOR_2)
#define TOUCH_3 TOUCH(SENSOR_3)
The macro only compare the value read from the sensor with a threshold. The
thresold is the mid point of the raw sensor range, maybe not the best
value. I prefere writing my own macro, so I can set (and change) the
threshold.
Note that SENSOR_X is the value read for the sensor X from the A/D
converter of the H8/300, so it's a 10-bit value put in the most significant
bits of a 16-bit variable.
For more documentation see http://legOS.sourceforge.net/docs/ .
bye
Bernardo
New e-mail: dibbe@freestation.it
|
|
Message is in Reply To:
| | Sensor Commands and legOS 0.2.3
|
| I just installed legOS 0.2.3 under Redhat 6.2, using the RPM's that were linked to in the HOWTO. Everything I have tried so far has worked great, except for getting my touch sensors to work. The documentation I have read said that in 0.2.x one could (...) (24 years ago, 24-Apr-01, to lugnet.robotics.rcx.legos)
|
2 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|