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 / 1195
1194  |  1196
Subject: 
Re: Coparison of Sensors
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Fri, 3 Jan 1997 13:35:43 GMT
Original-From: 
Tom G. Brusehaver/Consultant Euler Solutions <tgb@bnu003./Spamcake/cncc.bnr.com>
Reply-To: 
TGB@nomorespamBNR.COM
Viewed: 
1480 times
  
Hi,
I know this is probably a stupid question to you, but I wrote a program
to compare sensors.  But it doesn't seem to work.  Can anyone help??
Here it is


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 "while(1)", which will will cause it to get
stuck in those loops.  Maybe you need a break in the loop somewhere?

I think it should look like this:

void main(void)
{
printf(" I am the Lego        Bug!!");
while(!start_button())
   start_process(candle());
}
void candle()
{
fd(0);
bk(1);
while(1)
  {
    while(analog(2)< 20 + analog(3));
    sleep(2.0);
    fd(1);
  }
  while(1)
  {
    while(analog(3)< 20 + analog(2)+ 20)
        fd(1);
    bk(0);
    sleep(2.0);
    fd(0);
  }
  while(1)
  {
    while(analog(4)== analog(5))
        ao();
  }
}

--
tgb@bnr.com



Message has 1 Reply:
  Re: Coparison of Sensors
 
(...) 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 (...) (28 years ago, 3-Jan-97, to lugnet.robotics.handyboard)

Message is in Reply To:
  Coparison of Sensors
 
Hi, I know this is probably a stupid question to you, but I wrote a program to compare sensors. But it doesn't seem to work. Can anyone help?? Here it is (28 years ago, 2-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

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

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