To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 13029
  How2 'count' in NQC
 
In NQC you count by adding 1 to a variable like this: int counter; counter += 1 But it's hard to know *how much* you have counted; however, you can build a little program to (say) flash a light when you reach a certain count. I have spent about 4 (...) (24 years ago, 2-Nov-00, to lugnet.robotics)
 
  Re: How2 'count' in NQC
 
(...) The sensor returns 1 for as long as it's held down. In your code: (...) You are actually counting how long the switch is held down - in units of about a half second. So if you press and hold the switch for ten seconds, you'll get a count of (...) (24 years ago, 3-Nov-00, to lugnet.robotics)
 
  Re: How2 'count' in NQC
 
Steve, this is the third time you have helped me, and this time you obviously spent a lot of time working out the alternatives. First of all, the Wait (DELAY); in my inept code was not to flash every half second. It was to prevent additional counts (...) (24 years ago, 3-Nov-00, to lugnet.robotics)
 
  Re: How2 'count' in NQC
 
In lugnet.robotics, Jerry Kalpin writes: [SNIP] (...) There is an EDGE mode available through the firmware that only counts transitions between pressed and non-pressed (actually some raw threshold value if I remember correctly) states. This sensor (...) (24 years ago, 3-Nov-00, to lugnet.robotics)
 
  Re: How2 'count' in NQC
 
I have noticed this ongoing thread about the difficulties of debouncing and counting switch closures, and I must say that it is a very real problem anywhere electromechanical switches are interfaced to electronics which is orders of magnitude (...) (24 years ago, 3-Nov-00, to lugnet.robotics)
 
  Re: How2 'count' in NQC
 
I want to thank everyone who helped with the double problem of switch de-bouncing and that loops can often count continuously while the switch is in actuation. There were good suggestions about removing delays from the code and 'counting' upon (...) (24 years ago, 4-Nov-00, to lugnet.robotics)

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR