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 / 1214
1213  |  1215
Subject: 
monitoring touch sensor
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Fri, 31 Aug 2001 22:48:17 GMT
Viewed: 
2229 times
  
Greetings

I have recently been learning to program in NQC and have run into a problem.

I would like to monitor a touch sensor (with a Scout) so that if the sensor
is pressed once and held down a motor runs forward.  If the touch sensor is
pressed twice within a given time (eg. 2 seconds) and held down than the
motor runs in reverse.  What would be a good way to do this?

Please keep in mind the Scout does not support Pulse or Edge modes.

There is no doubt a simple and efficient solution to this problem, but so
far my attempts have failed, any help would be appreciated.

Thanks
Jason Yee



Message has 1 Reply:
  Re: monitoring touch sensor
 
(...) FYI, Jason and I ended up with this program: int touch_count=0; int release_count=0; task main() { while (true) { // infinite loop // look for first press until(SENSOR_1 == 1); PlaySound(SOUND_CLICK); touch_count = 1; // wait for 1 second for (...) (23 years ago, 15-Sep-01, to lugnet.robotics.rcx.nqc)

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