Xref: lugnet.com lugnet.robotics:2765 Newsgroups: lugnet.robotics Path: lugnet.com!lugnet From: lego-robotics@crynwr.com (Ben Williamson) Subject: Re: simple but functional radar Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: benw@maggie.casagrande.way Organization: None X-Nntp-Gateway: lego-robotics@crynwr.com Message-ID: References: <369D1E3D.D02985@usit.net> Mime-Version: 1.0 X-Nntp-Posting-Host: lugnet.com Date: Thu, 14 Jan 1999 09:30:19 GMT Original-From: Ben Williamson Lines: 65 On Wed, 13 Jan 1999, Chris Stanley wrote: > i'm so new to this that i've not yet sat down and learned nqc or botcode or > the like. radar.prg was written with the basic coder included on your > mindstorms cd. Chris, I built a little RadarBot just like yours (very minimalist, I love it :) and wrote some NQC code to drive it around my kitchen floor. It really zooms, until the left wheel inevitably falls off. :) The program below might help you get started with NQC, which I thoroughly recommend if you're at all familiar with C syntax. Cheers, - Ben. ------------------------------------------------------------------- Ben Williamson benw@pobox.com http://www.pobox.com/~benw/ #define LIGHT IN_2 #define LEFT OUT_A #define RIGHT OUT_C #define SPEED 7 /* connections to both motors are reversed: */ #define L_FWD Rev(LEFT, SPEED) #define L_REV Fwd(LEFT, SPEED) #define R_FWD Rev(RIGHT, SPEED) #define R_REV Fwd(RIGHT, SPEED) #define STOP Off(LEFT); Off(RIGHT) #define THRES 50 int light; task main { Sensor(LIGHT, IN_LIGHT); IRMode(IR_HI); L_FWD; R_FWD; while (1==1) { SendMessage(255); light = LIGHT; if (light > THRES) { L_REV; Sleep(10); } else { L_FWD; } } } -- Did you check the web site first?: http://www.crynwr.com/lego-robotics