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 / 21915
21914  |  21916
Subject: 
Re: Pneumatic valve mystery
Newsgroups: 
lugnet.robotics
Date: 
Fri, 26 Dec 2003 23:25:08 GMT
Viewed: 
1066 times
  
T. Alexander Popiel wrote:

  static void pOne()  {
    int pos = whichPosition;
    while (whichPosition != 1) {
      valveMotor.forward();
      pos = whichPosition;
    }
    LCD.showNumber(pos);
    valveMotor.stop();
  }


What about tighten the things a bit more with:

int pos = whichPosition;
    valveMotor.forward();
    while( pos != 1 ) {
       pos = whichPosition;
    }
    valveMotor.stop();
    LCD.showNumber( pos );

This should be the fastest loop I can think of in terms of stopping the
motor. You could change the other procedures in the same way.

Next step (if speed is an issue) could be to change to brickOS.

Regards,

Michael



Message is in Reply To:
  Re: Pneumatic valve mystery
 
(...) I suspect you're having problems with indeterminate values in the whichPosition variable. This might happen due to the SensorListener getting called in the middle of one of the tests for your while loops... or it might have some other cause. (...) (21 years ago, 26-Dec-03, to lugnet.robotics)

4 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