Home
Project Folders
Teacher Resources
Student Resources
How Do I?
Literacy
MWForum
Site Map
Search
Our Team

MWForum Message [Date Index] [Threads] [Authors] [Attachments] [Subscribe]

[Thread Prev] [Thread Next]

To: MicroWorlds Forum <mwforum@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: Fwd: manipulating text files and serial portcommunication
From: Joe Saggio <jsaggio@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 8 Mar 2011 20:43:47 -0500
Accept-language: en-US
Acceptlanguage: en-US

Thanks so much for responding!



[cid:imagea7f14c.gif@f1c571af.d2e940da]
[cid:image8b33e7.gif@a6142485.8c1b492d]



This e-mail and any files transmitted with it are intended only for the person
or entity to which it is addressed and may contain confidential material
and/or material protected by law. Any retransmission or use of this
information may be a violation of that law. If you received this in error,
please contact the sender and delete the material from any computer.

________________________________
From: mwforum-bounces@xxxxxxxxxxxxxxxxxxxxxxxxxxxx [mailto:mwforum-bounces@xxxxxxxxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Alain Tougas
Sent: Saturday, March 05, 2011 12:07 PM
To: Rotem Kimchi
Cc: MicroWorlds Forum
Subject: Re: Fwd: manipulating text files and serial port communication

Hi,

The big thing here is that the Logo interpreter works from right to left. So
let's do that on your IFELSE statement:

ASCII "| |
reports 32
:WORD = ASCII "| |
is like
:WORD = 32
This reports FALSE
Then
ASCII :WORD = ASCII "| |
is like
ASCII :WORD = 32
or
ASCII "FALSE
or
102
because ASCII "F = 102

Solution?
Remember that Logo comes from LISP which stands for Lots of Insipid Sets of
Parenthesis

While Logo will ALWAYS read from right to left, you can "arrange" things this
way:

IFELSE (ASCII :WORD) = (ASCII "| |)

ASCII "| |
will report 32
ASCII :WORD
will report whatever
WHATEVER = 32
will report TRUE or FALSE

and IFELSE will be happy.

Alain Tougas
LCSI


Le 2011-03-05 à 11:01, Rotem Kimchi a écrit :


Hi Daniel,
how are you?

why can't I had this next line to the asciify procedure

in case you don't see the procedure

 to asciify :word

if empty? :word [stop]

ifelse ascii :word = ascii "| | [asciify butfirst :word]

[.send ascii (first :word)  asciify butfirst :word]

end

I just don't want to send the ascii for space

this is the warning I get


102 is not true or false

are the two of the same variable type?

another thing I wanted to ask

can I read directly from the word command window ?

thanks in advance

2010/11/24 Daniel Ajoy <da.ajoy@xxxxxxxxx<mailto:da.ajoy@xxxxxxxxx>>

On Wed, 24 Nov 2010 06:02:22 -0500, Rotem Kimchi
<rotemk2@xxxxxxxxxxxxxxxx<mailto:rotemk2@xxxxxxxxxxxxxxxx>> wrote:
Yes I built a robot and I want to communicate with him using ZigBee protocol
through the serial port with logo commands. For now I am using a cable to burn
a programs to the robot using Robotc program but I want to use logo Pro.
At first I thought I could send logo's commands and then translate them using
the robot uP, but
I think that the command .send in logo cannot send chars only integers am I
correct?

No. You are sending characters. But you are sending them in ascii code

http://1.bp.blogspot.com/_inEdXKgdgj0/TG1oFopLTYI/AAAAAAAABNE/5KrCnphKrTU/s1600/ascii.gif

You should send the number in the DEC column if you want the transfer the
character in the CHAR column.

Logo has commands that do the conversion:

show ascii "A
65

show char 65
A

This procedure asciifies a word:

to asciify :word
if empty? :word [stop]
show ascii first :word
asciify butfirst :word
end

asciify "|fd 100|
102
100
32
49
48
48

Notice that "fd 100" is a single word (what is called a "string" in other
languages).
NOT a sentence with two words.

If so I'll send numbers that will represent the commands using the first bits
to described the OPCODE (the command type: fd seth,bk..) or a value, and after
that I'll send the number that described the command or the value itself.

If you wish.

As far as the robot it's not a problem to teach him new command words and make
him do what i want him to do.
I created the text file before I knew about the logo ability to use the serial
port and I wanted to take a file that have a singal command and using a c code
in order to translate him to a binary code and send him in the same way,
through the serial port.
You told me "I think using text files is easier... but maybe just because I've
never used serial port communication"
 so i wanted to know how come? , but you probably didn't  understood the all
purpose of the application.

Correct, I didn't understand that you wanted to transfer the content of those
text files to a robot.

Daniel
OpenWorld Learning



GIF image

GIF image


  • Previous by thread: Re: Fwd: manipulating text files and serial port communication
  • Next by thread: Re: move a turtle with the mouse

  • 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.


    © copyright 2001 - 2008