To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.trainsOpen lugnet.trains in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Trains / 23780
23779  |  23781
Subject: 
Using Code Pilot to control motorized cows
Newsgroups: 
lugnet.robotics.codepilot, lugnet.trains
Followup-To: 
lugnet.robotics.codepilot
Date: 
Thu, 2 Dec 2004 21:05:15 GMT
Viewed: 
517 times
  
Purists please skip this post as it involves non-LEGO sensors.

Lacking an RCX, but loving the motorized cows (
http://news.lugnet.com/announce/moc/?n=2177 ), I needed to find a way to
control them with the code pilot (from set 8479 Barcode Multi-Set) I
have.  The only LEGO sensor that works with the code pilot is the touch
sensor.  It would be too much trouble so I used reed switches instead
(work like a touch sensor when a magnet passes over them - direction
sensitive).  The code pilot can't do anything too complex (like if then
loops) so I had to simplify the programming a bit.  You can't easily
tell when the train has passed.

The programming is simple.  Modify it depending on the direction you
want the heads to turn (or change the direction the wires connect) and
the time it takes the heads to turn (battery strength, number of motors
controlled).  you can put in a delay between the sensor being 'pushed'
and the head turning if necessary.  Since I can't show the symbols
easily here, each line is a description of the symbol or amount you scan
from the card.

Touch sensor pushed in
motor rotate ccw
speed 20
0.4 seconds
stop
'dice' seconds (random number between 1 and 9)
motor rotate cw
speed 20
0.4 seconds
stop
1 second

Description of what happens:  When a magnet passes over the reed switch,
the cow head turns, waits randomly between 1 and 9 seconds, and then
turns back.  The program waits one second before looking again for the
sensor to be activated (stops whiplash).

For long trains, where the random number is low, the cow can do a double
take.

To sense the magnets between train cars, it is necessary to have the
reed switch parallel to the train tracks.  If you don't have magnets
between the cars, you can put the reed switch perpendicular to the track
and it will sense the LEGO train motors.  It is easy to sense trains on
multiple tracks (use multiple reed switches), but they have to be
travelling the same direction as with only one sensor input they are all
read together.

It has worked well in two NovaLUG shows.

Gail Meagher



Message has 1 Reply:
  Re: Using Code Pilot to control motorized cows
 
(...) Note that Jason Allemann created a smaller version, more akin to minifig scale: (URL) motor has to be in the base, but other than that it works exactly the same. ROSCO (20 years ago, 3-Dec-04, to lugnet.robotics.codepilot)

2 Messages in This Thread:

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

Custom Search

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