[Thread Prev] [Thread Next]
I have a vague memory of this and I may be getting this wrong, but if
you are looking at the values output by a sensor in the RCX display they
are going to be different that when you output the same sensor data to
MicroWorlds. So when you set a threshold like you're trying to here you
have to import a "ReadRCXMessage" turtle as explained in the sensors
section of the MW Robotics help pages. This turtle will print out the
sensor values to a text box, which you can then use to determine your
threshold. Again, I may be wrong about this.
With students I've just avoided this complication by using only the true
and false values for reflectors, which may also work in your case.
Erik Nauman
The Hewitt School
> -----Original Message-----
> From: mwforum-admin@xxxxxxxxxxxxxxxxxxxxxxxxxxxx [mailto:mwforum-
> admin@xxxxxxxxxxxxxxxxxxxxxxxxxxxx] On Behalf Of John St. Clair
> Sent: Monday, May 15, 2006 1:58 AM
> To: MWForum
> Subject: [MWForum] MW EX robotics question
>
> I have a student who built a project from a RoboLab kit using the RCX
> brick and he wanted to make some lights go on if the light sensor got
a
> reading over 33. His procedures are below and the lights never came
on
> even when the light sensor had a reading of 48.
>
> to light
> if reflect1 > 33 [aon con wait 5 aoff coff]
> end
>
> to basket
> loop [light]
> end
>
> So I suggested that he change the IF statement to less than 33 to see
> what would happen. The procedures he used are below and the lights
> came on and blinked on and off as expected but continued to blink on
> and off even when the light sensor reading was held at 48. We were
> expecting the basket procedure with the loop of the light procedure to
> make the computer continually check the value being reported by the
> light sensor and either turn the lights on and off, or not turn on the
> lights at all. It seems that what happens is that the computer checks
> the light sensor only once and whatever value is first reported is
> acted on continuously. Can anybody explain to me what is happening?
>
> to light
> if reflect1 < 33 [aon con wait 5 aoff coff]
> end
>
> to basket
> loop [light]
> end
>
> It just occurred to me that perhaps we could get the desired results
if
> we changed the procedures to the ones below. We will try it tomorrow.
> However, I still don't see why loop doesn't work the way I was
> expecting.
>
>
> to light
> if reflect1 < 33 [aon con wait 5 aoff coff]
> end
>
> to basket
> light
> basket
> end
>
>
> John St. Clair Global SchoolNet
Foundation
> john.stclair@xxxxxxxxxxx www.gsn.org
> Vina Danks Middle School LogoForum moderator
> Teacher of Logo and Lego groups.yahoo.com/group/logoforum
>
Previous by thread:
RE: MW EX robotics question
Next by thread:
RE: MW EX robotics question
To save an attachment to your computer, PC users should right-click (Mac users, click and hold the mouse button) on the link and then choose 'save target as' from the pop-up menu. A window will then pop up in which you can choose a location for the file.
|