To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.handyboardOpen lugnet.robotics.handyboard in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Handy Board / 1196
1195  |  1197
Subject: 
Re: Coparison of Sensors
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Fri, 3 Jan 1997 15:07:37 GMT
Original-From: 
rabbit <g-webb@studentsSPAMLESS.uiuc.edu>
Viewed: 
3976 times
  
On Fri, 3 Jan 1997, Tom G. Brusehaver/Consultant Euler Solutions wrote:

> Looks like you got too many semi-colons.  Take out the semi-colons on
> all the while lines where you want the while to do the following thing.

I agree.  You should only have a semi-colon after a while if you
dont want that while to loop through any instructions.  A semi-colon
after a while tells the compiler that all you want to do is continuously
test the while condition until it becomes false.  In the case of your
'while(1)', you will never get a false condition to end the loop.

> The process is getting to the "while(!start_button());" line and
> staying there.

Actually I think this is the only place where a semi-colon is not
only intended but necessary;  It is saying "loop forever until the start
button is pressed" which is a handy thing when you dont want your code
starting immediately after you turn on the handyboard.

> Also you have too many "while(1)", which will will cause it to get
> stuck in those loops.  Maybe you need a break in the loop somewhere?

It looks like from the code that you want to do 3 different
things depending on three different conditions; when analog2 is a certain
amount less than analog3, when analog3 is a certain amount less than
analog2 and when analog4 is equal to analog5.  Might I suggest that your
candle routine have a single while(1) loop with 'if' statements testing
each condition within;

candle {

while (1) {
if condition1 {
do action1;
}
if condition2 {
do action2;
}
if condition3 {
do action3;
}
}
}

Garth Webb



Message is in Reply To:
  Re: Coparison of Sensors
 
(...) Looks like you got too many semi-colons. Take out the semi-colons on all the while lines where you want the while to do the following thing. The process is getting to the "while(!start_button());" line and staying there. Also you have too many (...) (30 years ago, 3-Jan-97, to lugnet.robotics.handyboard)

3 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

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