serin modifier question
Archiver
Posts: 46,084
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
[noparse][[/noparse]Non-text portions of this message have been removed]
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
[noparse][[/noparse]Non-text portions of this message have been removed]
Comments
>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]
>[noparse][[/noparse]Non-text portions of this message have been removed]
>
>
>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/
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.
I'd guess you'll have to read the data as ASCII (your STR\14
approach) and then convert to numeric values in software.
One last thing that may be worth a try:
serin inpin,baudrate,[noparse][[/noparse]wait ("S"), DEC rot, DEC gelb, DEC blau]
This will let your Stamp decide how many digits are in each of the
alphanumeric numbers (the space following each serves as a
delimiter). It appears it's not always three digits.
Regards,
Steve
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?