Subject:
|
RE: Voltage generator
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Thu, 21 Jan 1999 13:56:42 GMT
|
Original-From:
|
Simen Svale Skogsrud <simen@mop.=nospam=no>
|
Reply-To:
|
<simen@(AntiSpam)mop.no>
|
Viewed:
|
1677 times
|
| |
| |
Dave Ryder wrote:
> Is
> there anywhere on your site where you have a code sample to
> share two sensors
> on one input?
I will post more code in a short while, but I am editing those web-pages on
a different computer than i keep my NQC programs so that needs a bit of
coordination. But I can outline the basics right away (i have no reference
right here so bear with me if I get some details wrong).
On the Vector Rover a touch sensor shares input with the "rotation sensor".
If you configure the input as a light sensor and requests RAW readings the
rotation sensor will yield two values: 512 and 0 (just about) while if you
press the touch-sensor the value will go up to 1024. The result is that the
rotation sensor is disabled if the touch sensor is engaged (there will be no
tacho counting). I usually implement this by using variables as "virtual
sensors" like this
int IN_LEFTBUMPER, IN_TACHO;
task tachoandleftbumperdriver
{
while (true)
{
if IN_1>1000
{
IN_LEFTBUMPER = 1;
continue;
}
IN_LEFTBUMPER = 0;
// insert code to count tachos here
}
}
It is important to disengage anything that would result in rotation on the
rotation-sensor the moment the left bumper is engaged or else you will lose
track of rotation. The light sensor shared with a touch sensor is
implemented in a similar manner.
Simen
--
Did you check the web site first?: http://www.crynwr.com/lego-robotics
|
|
Message is in Reply To:
| | RE: Voltage generator
|
| Way to go Simen! I just looked at your web site - Very cool. I can't wait to give this a try. Is there anywhere on your site where you have a code sample to share two sensors on one input? Regards, Dave Ryder. In article (...) (26 years ago, 21-Jan-99, to lugnet.robotics)
|
17 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
Active threads in Robotics
|
|
|
|