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 / 26900
26899  |  26901
Subject: 
Re: FindLight
Newsgroups: 
lugnet.robotics
Date: 
Sun, 25 Feb 2007 20:40:47 GMT
Viewed: 
3860 times
  
In lugnet.robotics, linmix <linmix@gmail.com> wrote:
     maxlight = SENSOR_2;
     OnFwd (A);
     OnRev (C);

     if (SENSOR_2 > maxlight)

I've run into a new obstacle though.
The first move commands are executed just fine, but the second set never
runs - or so it seems.

Looks like you're setting maxlight = SENSOR_2, then testing if (SENSOR_2 >
maxlight), which will rarely (if ever) be true, because the value of SENSOR_2 is
unlikely to change in such a short time. I think the first maxlight = SENSOR_2
statement should be outside (before) the loop. But I could be wrong.

Regards

ROSCO



Message has 1 Reply:
  Re: FindLight
 
Thanks. I thought setting maxlight before the 'if' statement would be enough, but moving it closer to the front (before the 'while' statement') did the trick. The bit after the while loop still gives me pain though. I've changed it a bit to be able (...) (18 years ago, 25-Feb-07, to lugnet.robotics)

Message is in Reply To:
  Re: FindLight
 
Thanks for the reply. I see I overlooked something significant there. Going over it all again I think I don't need 'light' Also, the parse errors are due to my omitting the ; at the end of each statement I've also discovered that I should put some (...) (18 years ago, 25-Feb-07, to lugnet.robotics)

10 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