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 / 26901
26900  |  26902
Subject: 
Re: FindLight
Newsgroups: 
lugnet.robotics
Date: 
Sun, 25 Feb 2007 22:42:33 GMT
Original-From: 
linmix <linmix@gmail.!avoidspam!com>
Viewed: 
3917 times
  
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 to see if the calculations are ok

OnRev (OUT_A);
OnFwd (OUT_C);
turnfind = turntime - time;
OnFor (OUT_A + OUT_C, turnfind);
Off (OUT_A + OUT_C);

I've declared turnfind at the beginning and set it to 0 (just in case)
According to BricxCC's 'Watching the brick' the values are ok, bu no
matter what the values the robot will only spin back for a fraction of a
second.

linmix


Ross Crawford wrote:
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
 
(...) //findlight.nqc #define A OUT_A #define C OUT_C int maxlight; int light; int time = 0; #define TURNTIME 500; //change to accomodate 1 turn #define ROTATE_CLOCKWISE OnFwd(A); OnRev(C); #define ROTATE_COUNTERCLOCKWISE OnFwd(C); OnRev(A); task (...) (18 years ago, 26-Feb-07, to lugnet.robotics)

Message is in Reply To:
  Re: FindLight
 
(...) 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 (...) (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