Shop OBEX P1 Docs P2 Docs Learn Events
AW: [basicstamps] serin modifier question — Parallax Forums

AW: [basicstamps] serin modifier question

ArchiverArchiver Posts: 46,084
edited 2002-11-28 07:42 in General Discussion
>Hi Stampers,
>
>after I tried to use your advice I have proceeded but I am still not
totally
>there. Here is one detailled question:
>
>I am using a CMU cam that sends serial information about colours etc. to
the
>stamp. Two different ways of reading the incoming data gives two different
>results. Why?
>
>
>serin inpin,baudrate,[noparse][[/noparse]skip 3,str wert\14]
>
>gives me the following result:
>
>S 121 171 87
>
>This seems to be right, when I change the object in front of the camera the
>data changes as one would expected. The first value increases for example
>when I show a red object which is right because the first value represents
>"red".
>
>When I use the following command instead:
>
>serin inpin,baudrate,[noparse][[/noparse]wait ("S"), dec3 rot,gelb,blau]
>
>I get the following:
>
>64 32 76
>
>This seems to be wrong and doesnot react properly to changing colour.
>Why is this and why do I get different results using the different commands
>at all?
>
>Thanks for your help,
>
>Uli
Uli -

Try the following:

serin inpin,baudrate,[noparse][[/noparse]wait ("S"), dec3 rot, dec3 gelb, dec3 blau]


I did, the result is even worse. I get wrong values, most of the time all
three values are the same! Strange, isn't it?

Thanks very much,

Uli



[noparse][[/noparse]Non-text portions of this message have been removed]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-11-28 07:42
    Hi Steve!


    Uli-

    If memory serves, you are reading a 9600 baud serial output from your
    camera. At that speed, your Stamp is probably falling behind reading
    the data when you use the DEC modifiers. My own experience suggests
    you can usually get away with one WAIT followed by one STR at 9600
    baud--any further modifiers won't work right once the data you're
    looking for is actually arriving, since the data keep coming while
    the Stamp does the conversions and storage. The Stamp falls behind,
    gets out of step with the data, and accepts whatever arrives at some
    later point instead.

    Richt, that's what I guessed too.

    I'd guess you'll have to read the data as ASCII (your STR\14
    approach) and then convert to numeric values in software.

    I am working on this one, not very easy because first you have to find out
    how many digits each number has before you can make decimals out of them...

    If you happen to know some elegant way to do that... :-)

    One last thing that may be worth a try:

    serin inpin,baudrate,[noparse][[/noparse]wait ("S"), DEC rot, DEC gelb, DEC blau]

    Tried this, doesnot help either. Time for a faster stamp!

    Thanks very much for your help, Steve!!

    Regards,

    Uli

    On 27 Nov 02 at 9:28, ulibasic wrote:

    > Hi Stampers,
    >
    > after I tried to use your advice I have proceeded but I am still not
    > totally there. Here is one detailled question:
    >
    > I am using a CMU cam that sends serial information about colours
    > etc. to the stamp. Two different ways of reading the incoming data
    > gives two different results. Why?

    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/




    [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.