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 / 24577
24576  |  24578
Subject: 
Re: Help me convert this train program to use events (NQC)
Newsgroups: 
lugnet.robotics
Date: 
Mon, 28 Nov 2005 05:51:18 GMT
Original-From: 
steve <sjbaker1@airmail.net^IHateSpam^>
Viewed: 
1547 times
  
Jordan Bradford wrote:

> Is this going to work?

One of the most important things with light sensors is calibrating the
threshold level.  What works the first time you try it will likely fail
when you run it at different times of the day and with room lights (and
Xmas tree lights!)...you really need the system to calibrate itself.
That works OK if the lighting is pretty constant - but if your train
is running all day, it might even have to adjust it's threshold
gradually throughout the day.

Perhaps it would be better to look for CHANGES in light level rather
than absolute values.

(eg Look for black/white at one end of the track and white/black at
the other.  Measure how fast the sensor sees the light brightness
change rather than exactly how bright the light is - and use the
direction of change - positive or negative to determine the direction
the motors should switch to).

> Also, is there anything better to put in the monitor
> block other than a while-loop that does nothing?

Yeah - if you do an empty while loop, it burns CPU time and denies the
other threads the chance to run.  Use at least a Wait(1) inside the loop.



Message is in Reply To:
  Help me convert this train program to use events (NQC)
 
For Christmas I'm setting up a LEGO train on top of a narrow wall, so it has to operate like a shuttle -- stop at each end and reverse motor direction. My first attempt had a train regulator attached to a polarity switch, with the switch being (...) (19 years ago, 28-Nov-05, to lugnet.robotics, lugnet.robotics.rcx, lugnet.robotics.rcx.nqc, lugnet.trains, FTX)

16 Messages in This Thread:






Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    
Active threads in Robotics

 
Verified and Trusted Team of Hackers
3 hours ago
Custom Search

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