To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.nqcOpen lugnet.robotics.rcx.nqc in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / NQC / 1282
1281  |  1283
Subject: 
Re: How to read the touch sensors on the Scout in NQC?
Newsgroups: 
lugnet.robotics.rcx.nqc, lugnet.robotics.scout
Date: 
Mon, 17 Dec 2001 18:52:50 GMT
Viewed: 
5596 times
  
I was using my scout this past weekend as a coinbox detector to launch a
mono rail. The touch sensors work exactly as Dave suggests.

You can also just do the following:

until(SENSOR_1);
Waits until it's touched.
until(!SENSOR_1);

Waits until the sensor is clear. (Notice the !  that means the reverse
condition)

Because there is no sensor configuration Dave was kind enough to add the
RAW sensor readings so we can use other types of sensors (Including some
Phototransistor light sensors) etc...

Dean

Dave Baum wrote:

This program turns on motor A and leaves it running until a touch sensor
attached to input 1 is pressed, then it turns off the motor and plays a
sound:

task main()
{
   On(OUT_A);
   until(SENSOR_1 == 1);
   Off(OUT_A);
   PlaySound(SOUND_UP);
}

Dave

In article <3C1C4A7D.90000@superfami.com>, Chris Barker
<chris@superfami.com> wrote:

All,

I'm feeling pretty stupid right about now. I've read the NQC docs,
looked in the newsgroups, books, etc, but I can't seem to figure out how
to read the touch sensors on my Scout.

I want to implement a bumper checking task but no matter how I try it,
it seems that the task believes the touch sensors are pressed even when
they are not. My code is just way too messy to post any snippets, I'd
appretiate it if someone could post some example code.

TIA,

Chris Barker
chris"atmark"superfami"dot"com

--
reply to: dbaum at enteract dot com


--
Dean Husby
LUGNET Member #320
TFM's LEGO Workshop - http://www.akasa.bc.ca/tfm
The Vancouver LEGO Club - http://www.akasa.bc.ca/vlc/



Message is in Reply To:
  Re: How to read the touch sensors on the Scout in NQC?
 
This program turns on motor A and leaves it running until a touch sensor attached to input 1 is pressed, then it turns off the motor and plays a sound: task main() { On(OUT_A); until(SENSOR_1 == 1); Off(OUT_A); PlaySound(SOUND_UP); } Dave (...) (23 years ago, 16-Dec-01, to lugnet.robotics.rcx.nqc, lugnet.robotics.scout)

6 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