[Thread Prev] [Thread Next]
Yes, Susan, this is an excellent summary of a topic that one almost has
to figure out empirically to understand. I'm savin' this in my
documentation files!
Thanks.
Erik Nauman
> -----Original Message-----
> From: mwforum-admin@xxxxxxxxxxxxxxxxxxxxxxxxxxxx [mailto:mwforum-
> admin@xxxxxxxxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Ray Catzel
> Sent: Tuesday, May 16, 2006 8:10 AM
> To: mwforum@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [MWForum] MW EX robotics question
>
> Hi Susan
> Well summarized. It is an area that is not clearly documented.
> regards
> --ray
>
> -----Original Message-----
> From: mwforum-admin@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
> [mailto:mwforum-admin@xxxxxxxxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Susan
> Einhorn
> Sent: May 15, 2006 4:07 PM
> To: mwforum@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [MWForum] MW EX robotics question
>
>
> Hi John,
>
>
> The reflect primitive in MicroWorlds EX must be initialized before
using
> it.
> In the robotics direct mode area, after a positive beep test, type a
> command
> that involves reflect1 (or 2 or 3, depending). Could be:
> sm reflect1
> That's asking the rcx to send the message "value of reflect1" but the
> message will be lost. It is, in that sense, not elegant (unless you
have a
> readrcxmessage turtle or button currently running).
> A more complete and elegant instruction would be:
> if reflect1 [aonfor 5]
> (Before initializing reflect1, the instruction sm sensor1 outputs a
> number,
> but I believe the output is erratic and not related to the actual
sensor
> reading).
> After initializing this primitive, reflect will output either 0 or 1.
It
> reports 1 if the light sensor connected to the port (1, 2 or 3) has
moved
> from a bright or reflective (shiny) surface to a dark surface. It
reports
> 0
> if the sensor has moved from a dark surface to a bright surface. 1 is
the
> equivalent of "true" and 0 is false.
>
> If you want to work with sensor values, you need to follow the above
> initializing step and then use sensor1 instead of reflect1. Sensor1
> should
> output the value that is shown on the RCX brick.
>
> The readRCXmessage turtle is useful, but it's not the only way to
check
> the
> output from a sensor. You could simply create a text box and a button.
The
> button's instruction could be:
> waituntil [remotemessage?] pr remotemessage
>
> Click the button. MicroWorlds is waiting to "hear" from the sensor.
>
> In the robotics direct mode, type:
> sendmessage sensor1
>
> A value should be printed in the text box.
>
> Once the changes are made for the sensor, your loop should work as
> originally written.
> I hope this helps.
>
> Susan
> LCSI
>
> -----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.
|